sm.physics.distanceRaycast

Performs a distance ray cast from a position with a given direction.

Kind: Function

Environments: Game

Game

sm.physics.distanceRaycast( start, direction )

Open the full Game reference

Note: sm.physics.distanceRaycast is generally cheaper to use than sm.physics.raycast as it performs collision checks in a simplified world. If the raycast is only used for checking collision, it is advised to use this method instead.

Parameters:

Name Type Description
start Vec3 The start position.
direction Vec3 The ray's direction and length.

Returns:

Type Description
boolean 2 values: whether raycast was successful
number the fraction (0–1) of the distance reached until collision divided by the ray's length.