SixL client API / raycasting / RaycastResult

Interface: RaycastResult

What a ray test hit.

Example

const hit = await mp.raycasting.testPointToPoint(from, to);
    if (hit) mp.console.logInfo(`hit at ${hit.position.x}`);

Properties

entity

entity: number | EntityMp

The entity hit: a player, ped, vehicle or object the client knows, else 0 (the ground, a building, a map prop).

Example

if (typeof hit.entity !== 'number') { }

position

position: Vector3

Where the ray hit, in metres.

Example

const where = hit.position;

surfaceNormal

surfaceNormal: Vector3

The direction the hit surface faces (a unit vector).

Example

const up = hit.surfaceNormal.z > 0.9;