Physics

Access to the physics scene

.constructor(engine: WonderlandEngine) ⇒ Physics 

ParamTypeDescription
engineWonderlandEngine

._engine: WonderlandEngine 

Wonderland Engine instance

.rayCast(o: Readonly<NumberArray>, d: Readonly<NumberArray>, group: number, maxDistance: number) ⇒ RayHit 

Cast a ray through the physics scene and find intersecting objects.

The resulting ray hit will contain up to 4 closest ray hits, sorted by increasing distance.

Returns: The RayHit instance, belonging to this class.

Note: The returned RayHit object is owned by the Physics instance and will be reused with the next rayCast call.

ParamTypeDescription
oReadonly<NumberArray>Ray origin.
dReadonly<NumberArray>Ray direction.
groupnumberCollision group to filter by: only objects that are part of given group are considered for raycast.
maxDistancenumberMaximum ray distance, default 100.0.