Ray Class
A line in 3D space that intersects bodies and return points.
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.
intersectBox
-
shape
-
quat
-
position
-
body
Parameters:
-
shape
Shape -
quat
Quaternion -
position
Vec3 -
body
Body
intersectConvex
-
shape
-
quat
-
position
-
body
-
[options]
Parameters:
-
shape
Shape -
quat
Quaternion -
position
Vec3 -
body
Body -
[options]
Object optional-
[faceList]
Array optional
-
intersectHeightfield
-
shape
-
quat
-
position
-
body
Parameters:
-
shape
Shape -
quat
Quaternion -
position
Vec3 -
body
Body
intersectPlane
-
shape
-
quat
-
position
-
body
Parameters:
-
shape
Shape -
quat
Quaternion -
position
Vec3 -
body
Body
intersectShape
-
shape
-
quat
-
position
-
body
Parameters:
-
shape
Shape -
quat
Quaternion -
position
Vec3 -
body
Body
intersectSphere
-
shape
-
quat
-
position
-
body
Parameters:
-
shape
Shape -
quat
Quaternion -
position
Vec3 -
body
Body
intersectTrimesh
-
shape
-
quat
-
position
-
body
-
[options]
Parameters:
-
shape
Shape -
quat
Quaternion -
position
Vec3 -
body
Body -
[options]
Object optional
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
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.
collisionFilterGroup
Number
Default: -1
collisionFilterMask
Number
Default: -1
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.