XR

XR Manager

The XR manager is part of the Engine instance and can be accessed via engine.xrManager. It acts as the central controller in XR, primarily managing:

Properties

PropertyTypeDescription
sessionManagerXRSessionManagerSession manager for managing the XR session lifecycle and context. Use it to monitor session state changes.
inputManagerXRInputManagerInput manager for handling all XR inputs (controllers, HMDs, cameras, etc.). Use it to access device information.
cameraManagerXRCameraManagerCamera manager for connecting virtual and real-world cameras in XR space.
featuresXRFeatureAll enabled XR features.
originEntityThe origin point during XR initialization, bridging the virtual and real worlds.

If the origin node is placed at scene position (1, 1, 1), and the tracked camera position is (x, y, z) when entering XR, the camera's world position in the scene becomes (1 + x, 1 + y, 1 + z). This transformation aligns the origin's local coordinates with world coordinates.

Methods

MethodDescription
isSupportedFeatureChecks if a specific feature is supported. Developers can use this to verify environment compatibility before usage.
addFeatureAdds a specific XR feature, similar to attaching a component to a node.
getFeatureRetrieves a specific XR feature, similar to fetching a component from a node.
enterXREnters an XR session. Choose the session type (AR or VR). If autoRun is not explicitly specified, XR logic will automatically start after session entry.
exitXRExits the XR session. All XR logic stops, added features are destroyed, and configurations are not saved.

Overall Workflow

Based on the above properties and methods, the XR workflow is structured as follows:

Was this page helpful?