Ray Class
A line with a start and end point that is used to intersect shapes.
Constructor
Ray
()
Item Index
Methods
Methods
_updateDirection
()
private
Updates the _direction vector.
intersectBodies
-
bodies
-
[result]
Parameters:
-
bodies
ArrayAn array of Body objects.
-
[result]
RaycastResult optionalDeprecated
intersectBody
-
body
-
[result]
Shoot a ray at a body, get back information about the hit.
Parameters:
-
body
Body -
[result]
RaycastResult optionalDeprecated - set the result property of the Ray instead.
intersectPlane
-
shape
-
angle
-
position
-
body
intersectRectangle
-
shape
-
angle
-
position
-
body
intersectShape
-
shape
-
angle
-
position
-
body
intersectWorld
-
world
-
options
Do itersection against all bodies in the given World.
Parameters:
-
world
World -
options
Object
Returns:
True if the ray hit anything, otherwise false.
Properties
_direction
Array
private
callback
Function
Current, user-provided result callback. Will be used if mode is Ray.ALL.
checkCollisionResponse
Boolean
Set to true if you want the Ray to take .collisionResponse flags into account on bodies and shapes.
collisionGroup
Number
Default: -1
collisionMask
Number
Default: -1
from
Array
hasHit
Boolean
Will be set to true during intersectWorld() if the ray hit anything.
mode
Number
The intersection mode. Should be Ray.ANY, Ray.ALL or Ray.CLOSEST.
precision
Number
The precision of the ray. Used when checking parallelity etc.
skipBackfaces
Boolean
If set to true, the ray skips any hits with normal.dot(rayDirection) < 0.