Physics
Access to the physics scene
- Physics
- .constructor(engine) ⇒ Physics
- ._engine: WonderlandEngine
- .rayCast(o, d, group, maxDistance) ⇒ RayHit
.constructor(engine: WonderlandEngine) ⇒ Physics
Param | Type | Description |
---|---|---|
engine | WonderlandEngine |
._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.
Param | Type | Description |
---|---|---|
o | Readonly<NumberArray> | Ray origin. |
d | Readonly<NumberArray> | Ray direction. |
group | number | Collision group to filter by: only objects that are part of given group are considered for raycast. |
maxDistance | number | Maximum ray distance, default 100.0 . |