CollisionComponent
Native collision component.
Provides access to a native collision component instance.
- CollisionComponent
- .CollisionComponent.TypeName: string
- .collider
- .extents
- .group
- .radius
- .getExtents<T>(out) ⇒ T
- .queryOverlaps() ⇒ CollisionComponent[]
.TypeName: string
.collider: Collider
Collision component collider
.collider
Set collision component collider.
.extents: Float32Array
Equivalent to getExtents.
Note: Prefer to use getExtents for performance.
.extents
Set collision component extents.
If collider returns Sphere, only the first component of the passed vector is used.
Example:
.group: number
Collision component group.
The groups is a bitmask that is compared to other components in queryOverlaps or the group in rayCast.
Colliders that have no common groups will not overlap with each other. If a collider has none of the groups set for rayCast, the ray will not hit it.
Each bit represents belonging to a group, see example.
.group
Set collision component group.
.radius: number
Get collision component radius.
Note: If collider is not Sphere, the returned value corresponds to the radius of a sphere enclosing the shape.
Example:
.radius
Set collision component radius.
Note: If collider is not Sphere, the extents are set to form a square that fits a sphere with the provided radius.
Example:
.getExtents<T>(out: T) ⇒ T
.getExtents() ⇒ Float32Array
Collision component extents.
If collider returns Sphere, only the first component of the returned vector is used.
Returns: The out
parameter.
Param | Type | Description |
---|---|---|
out | T | Destination array/vector, expected to have at least 3 elements. |
Template Param | Type Definition |
---|---|
T | extends NumberArray |
.queryOverlaps() ⇒ CollisionComponent[]
Query overlapping objects.
Usage:
Returns: Collision components overlapping this collider.