Convex Hull Collider
Updated
Shrink-wrapped collision around the mesh; works on moving bodies.
- Type
comp-convex-hull-collider- Script class
ConvexHullColliderComponent- Per entity
- Several
- Version
- 2.0.0
Read about it in Rigid bodies and colliders: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
collision |
0 ≤ x ≤ 15, integer |
|
friction |
0 ≤ x ≤ 5 |
|
offset |
||
offset.x |
- |
|
offset.y |
- |
|
offset.z |
- |
|
restitution |
0 ≤ x ≤ 1 |
|
rotation |
||
rotation.x |
||
rotation.y |
||
rotation.z |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
PhysicsCollider::collision-enterPhysicsCollider::collision-exitPhysicsCollider::intersection-enterPhysicsCollider::intersection-exit
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Faceted rocks fall and tumble to rest on their flat faces: each Convex Hull Collider wraps its rock's mesh, squashed or not, as tightly as a convex shape can. The script drops them again every few seconds.
Watch the rocks bounce off each other and settle on a face, never on a corner. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(ConvexHullColliderComponent); if (component) log(component.props);}