sm.physics.raycast

Performs a ray cast between two positions.

Kind: Function

Environments: Game

Game

sm.physics.raycast( start, end, body, mask, world, ignoreUuids )

Open the full Game reference

The returned RaycastResult contains information about any object intersected by the ray.

If the ray cast is called from within a shape (e.g. a Sensor), a Body may be provided which the ray will not intersect.

Parameters:

Name Type Description
start Vec3 The start position.
end Vec3 The end position.
body (optional) Body The body to be ignored. (Optional)
mask (optional) integer The collision mask. Defaults to sm.physics.filter.default (Optional)
world (optional) World The world to perform the raycast in. (Optional)
ignoreUuids (optional) table A table of uuids {Uuid, ...} of Shape, Harvestable or Character type to be ignored. (Optional)

Returns:

Type Description
boolean True if raycast was successful
RaycastResult The raycast result data.