API Docs for: 0.6.1
Show:

Ray Class

A line in 3D space that intersects bodies and return points.

Constructor

Ray

(
  • from
  • to
)

Parameters:

Methods

_updateDirection

() private

Updates the _direction vector.

getAABB

(
  • aabb
)

Get the world AABB of the ray.

Parameters:

intersectBodies

(
  • bodies
  • [result]
)

Parameters:

  • bodies Array

    An array of Body objects.

  • [result] RaycastResult optional

    Deprecated

intersectBody

(
  • body
  • [result]
)
private

Shoot a ray at a body, get back information about the hit.

Parameters:

  • body Body
  • [result] RaycastResult optional

    Deprecated - set the result property of the Ray instead.

intersectBox

(
  • shape
  • quat
  • position
  • body
)
private

Parameters:

intersectConvex

(
  • shape
  • quat
  • position
  • body
  • [options]
)
private

Parameters:

intersectHeightfield

(
  • shape
  • quat
  • position
  • body
)
private

Parameters:

intersectPlane

(
  • shape
  • quat
  • position
  • body
)
private

Parameters:

intersectShape

(
  • shape
  • quat
  • position
  • body
)
private

Parameters:

intersectSphere

(
  • shape
  • quat
  • position
  • body
)
private

Parameters:

intersectTrimesh

(
  • shape
  • quat
  • position
  • body
  • [options]
)
private

Parameters:

intersectWorld

(
  • world
  • options
)
Boolean

Do itersection against all bodies in the given World.

Parameters:

  • world World
  • options Object

Returns:

Boolean:

True if the ray hit anything, otherwise false.

reportIntersection

(
  • normal
  • hitPointWorld
  • shape
  • body
)
Boolean private

Parameters:

Returns:

Boolean:

True if the intersections should continue

Properties

_direction

Vec3 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.

collisionFilterGroup

Number

Default: -1

collisionFilterMask

Number

Default: -1

from

Vec3

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.

result

RaycastResult

Current result object.

skipBackfaces

Boolean

If set to true, the ray skips any hits with normal.dot(rayDirection) < 0.