XR Origin
Updated
How the player rig sits on the spawn point; recenter support.
- Type
comp-xr-origin- Script class
XROriginComponent- Per entity
- One
- Version
- 2.0.0
Read about it in XR Origin: 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 |
|---|---|---|
floorOffset |
- |
|
worldScale |
0. |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
XROrigin::recenterXROrigin::reset
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A recenter button with feedbackA UI Button recenters the XR Origin, and the controllers buzz when the XR Origin reports the recenter; a reset from the headset is logged.
Press Recenter. On a desktop there is no XR session to recenter; in a headset the view snaps back to the home placement and the controllers buzz.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(XROriginComponent); if (component) log(component.props);}