RayHit
Ray hit.
Result of a rayCast or rayCast.
Note: this class wraps internal engine data and should only be created internally.
- RayHit
- .constructor(scene, ptr) ⇒ RayHit
- .distances
- .engine
- .hitCount
- .locations
- .normals
- .objects
- .getDistances<T>(out) ⇒ T
- .getLocations<T>(out) ⇒ T
- .getNormals<T>(out) ⇒ T
- .getObjects(out) ⇒ Object3D[]
.constructor(scene: Scene, ptr: number) ⇒ RayHit
Param | Type | Description |
---|---|---|
scene | Scene | |
ptr | number | Pointer to the ray hits memory. |
.distances: Float32Array
Equivalent to getDistances.
Note: Prefer to use getDistances for performance.
.engine: WonderlandEngine
Hosting engine instance.
.hitCount: number
Number of hits (max 4)
.locations: Float32Array[]
Equivalent to getLocations.
Note: Prefer to use getLocations for performance.
.normals: Float32Array[]
Equivalent to getNormals.
Note: Prefer to use getNormals for performance.
.objects: null | Object3D[]
Equivalent to getObjects.
Note: Prefer to use getObjects for performance.
.getDistances<T>(out: T) ⇒ T
.getDistances() ⇒ Float32Array
Prefer these to recalculating the distance from locations.
Distances of array hits to ray origin.
Returns: The out
parameter.
Param | Type | Description |
---|---|---|
out | T | Destination array/vector, expected to have at least this.hitCount elements. |
Template Param | Type Definition |
---|---|
T | extends NumberArray |
.getLocations<T>(out: T) ⇒ T
.getLocations() ⇒ Float32Array[]
Array of ray hit locations.
Usage
Returns: The out
parameter.
Param | Type | Description |
---|---|---|
out | T | Destination array of arrays/vectors, expected to have at least this.hitCount elements. Each array is expected to have at least 3 elements. |
Template Param | Type Definition |
---|---|
T | extends NumberArray[] |
.getNormals<T>(out: T) ⇒ T
.getNormals() ⇒ Float32Array[]
Array of ray hit normals (only when using rayCast.
Returns: The out
parameter.
Param | Type | Description |
---|---|---|
out | T | Destination array of arrays/vectors, expected to have at least this.hitCount elements. Each array is expected to have at least 3 elements. |
Template Param | Type Definition |
---|---|
T | extends NumberArray[] |
.getObjects(out: Object3D[]) ⇒ Object3D[]
Array of hit objects.
Returns: The out
parameter.
Param | Type | Description |
---|---|---|
out | Object3D[] | Destination array/vector, expected to have at least this.hitCount elements. |