XR Plane Collider
Updated
Physics collides with detected real planes.
- Type
comp-xr-plane-collider- Script class
XRPlaneColliderComponent- Per entity
- Several
- Version
- 2.0.0
Read about it in XR world: 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.
XR Planes with an XR Plane Collider and XR Meshes with an XR Mesh Collider make the detected room solid, drawn as translucent blue as in the runtime AR Placement demo. Balls drop every two seconds and bounce on the real floor and furniture.
This one needs AR: enter AR on a device that detects planes or room meshes and the balls land on real surfaces. On a desktop nothing is detected, so a virtual floor catches them.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(XRPlaneColliderComponent); if (component) log(component.props);}