Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ray

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

Hierarchy

  • Ray

Index

Constructors

constructor

Properties

callback

callback: RaycastCallback

User-provided result callback. Will be used if mode is Ray.ALL.

checkCollisionResponse

checkCollisionResponse: boolean

Set to false if you don't want the Ray to take collisionResponse flags into account on bodies and shapes.

default

true

collisionFilterGroup

collisionFilterGroup: number

collisionFilterGroup

default

-1

collisionFilterMask

collisionFilterMask: number

collisionFilterMask

default

-1

direction

direction: Vec3

direction

from

from: Vec3

from

hasHit

hasHit: boolean

Will be set to true during intersectWorld() if the ray hit anything.

mode

mode: number

The intersection mode. Should be Ray.ANY, Ray.ALL or Ray.CLOSEST.

default

RAY.ANY

precision

precision: number

The precision of the ray. Used when checking parallelity etc.

default

0.0001

result

Current result object.

skipBackfaces

skipBackfaces: boolean

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

default

false

to

to: Vec3

to

Static ALL

ALL: 4 = RAY_MODES.ALL

ALL

Static ANY

ANY: 2 = RAY_MODES.ANY

ANY

Static CLOSEST

CLOSEST: 1 = RAY_MODES.CLOSEST

CLOSEST

Methods

getAABB

  • getAABB(aabb: AABB): void

intersectBodies

  • Shoot a ray at an array bodies, get back information about the hit.

    deprecated

    @param result set the result property of the Ray instead.

    Parameters

    Returns void

intersectBody

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

    deprecated

    @param result set the result property of the Ray instead.

    Parameters

    Returns void

intersectWorld

  • Do itersection against all bodies in the given World.

    Parameters

    Returns boolean

    True if the ray hit anything, otherwise false.

Static pointInTriangle