DirkScripts Logo

Login With FiveM

Login

πŸ“š Library
β€Ί
Modules
β€Ί

raycast

Raycast

ℹ️ Client Module

lib.raycast.fromCoords

Casts a ray between two world coordinates and returns collision data.

lua
local hit, endCoords, entityHit, surfaceNormal, materialHash = lib.raycast.fromCoords(coords, destination, flags, ignore)
ParameterTypeRequiredDescription
coordsvector3yesStart position
destinationvector3yesEnd position
flagsnumbernoShapetest flags (default: 511 ALL)
ignorenumbernoShapetest ignore flags (default: 4 NO_COLLISION)

Returns: hit: boolean, endCoords: vector3, entityHit: number, surfaceNormal: vector3, materialHash: number

lib.raycast.fromCamera

Casts a ray from the camera through the crosshair.

lua
local hit, endCoords, entityHit, surfaceNormal, materialHash = lib.raycast.fromCamera(flags, ignore, distance, cam)
ParameterTypeRequiredDescription
flagsnumbernoShapetest flags (default: 511)
ignorenumbernoShapetest ignore flags (default: 4)
distancenumbernoMax ray distance (default: 1000.0)
camnumbernoCamera handle (default: gameplay camera)

lib.raycast.world3dToScreen2d

Converts a 3D world position to 2D screen coordinates.

lua
local screenPos = lib.raycast.world3dToScreen2d(pos) -- vector2

Shapetest Flags

ValueFlag
1MOVER
2VEHICLE
4PED
8RAGDOLL
16OBJECT
32PICKUP
64GLASS
128RIVER
256FOLIAGE
511ALL

Shapetest Ignore

ValueFlag
1GLASS
2SEE_THROUGH
3GLASS + SEE_THROUGH
4NO_COLLISION
7ALL

Copyright Β© 2026 DirkScripts.

Not affiliated with or endorsed by Rockstar North, Take-Two Interactive, or any other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc.
Our checkout system is provided by Tebex Limited, who manage payment processing, product delivery, and billing support. Prices shown in currencies other than GBP are approximate conversions updated daily. All purchases are processed in GBP, so the final amount charged may vary depending on your bank or payment provider’s exchange rate.