Skip to content
M2O Scripting APIScripting reference
Data shapeClient APIGenerated

RaycastHit

Defined in: client/api.d.ts:1261

The closest physics surface a ray hit.

distance: number

Defined in: client/api.d.ts:1275

Distance from the ray origin to the hit point, in metres.


entity: Vehicle | Player | null

Defined in: client/api.d.ts:1290

Handle of the hit player or vehicle, or null for anything else.


networkId: number | null

Defined in: client/api.d.ts:1285

Network id of the hit player, vehicle, npc or prop, or null for anything else.


normal: Vector3

Defined in: client/api.d.ts:1270

World-space surface normal at the hit point.


position: Vector3

Defined in: client/api.d.ts:1265

World-space hit point.


type: "object" | "vehicle" | "ped" | "prop" | "world" | "player" | "npc"

Defined in: client/api.d.ts:1280

What was hit. world is static geometry; ped, vehicle and object without a networkId are native entities no script entity owns.