Skip to main content

raycastScreenPoint

Casts a ray from a point on the screen and returns the hit information.

Syntax

engine.world.raycaster.raycastScreenPoint(x, y, far, options);

Parameters

NameTypeDescription
xnumberThe x-coordinate of the pixel on the screen.
ynumberThe y-coordinate of the pixel on the screen.
farnumber or nullThe maximum distance the ray can travel before it is considered to have missed its target. If null, then there is no maximum distance limit.
options (optional)RaycastOptionsAdditional options for the raycast.

Returns

Example

const intersects = engine.world.raycaster.raycastScreenPoint(
200, // x
400, // y
);

console.log('what did we hit?', intersects);

Available on: Client