API Docs for: 0.7.1
Show:

RaycastResult Class

Storage for Ray casting hit data.

Constructor

RaycastResult

()

Methods

getHitDistance

(
  • ray
)

Get the distance to the hit point.

Parameters:

getHitPoint

(
  • out
  • ray
)

Get world hit point.

Parameters:

  • out Array
  • ray Ray

hasHit

()

Returns true if the ray hit something since the last reset().

reset

()

Reset all result data. Must be done before re-using the result object.

set

(
  • normal
  • shape
  • body
  • fraction
)
private

Parameters:

  • normal Array
  • shape Shape
  • body Body
  • fraction Number

shouldStop

(
  • ray
)
Boolean private

Parameters:

Returns:

Boolean:

stop

()

Can be called while iterating over hits to stop searching for hit points.

Properties

body

Body

The hit body, or null.

faceIndex

Number

The index of the hit triangle, if the hit shape was indexable.

Default: -1

fraction

Number

Distance to the hit, as a fraction. 0 is at the "from" point, 1 is at the "to" point. Will be set to -1 if there was no hit yet.

Default: -1

isStopped

Boolean

If the ray should stop traversing.

normal

Array

The normal of the hit, oriented in world space.

shape

Shape

The hit shape, or null.