Determines the scale of the user relative to the scene in AR. Larger values make the 3D content appear smaller.
Only applies when usePlacementReticle
is enabled.
When enabled, the AR session root center will be automatically adjusted to place the center of the scene.
This helps ensure the scene is properly aligned with detected surfaces.
When enabled, the scene will be automatically placed as soon as a suitable surface is detected in AR, without requiring the user to tap to confirm placement.
When enabled, a button will be automatically added to NeedleMenu that allows users to enter AR mode.
When enabled, a QR code will be generated and displayed on desktop devices to allow easy opening of the experience on mobile devices.
When enabled, a button to send the experience to an Oculus Quest will be shown if the current device does not support VR. This helps direct users to compatible devices for optimal VR experiences.
When enabled, a button will be automatically added to NeedleMenu that allows users to enter VR mode.
Optional
customARPlacementOptional custom 3D object to use as the AR placement reticle instead of the default one.
Optional
defaultSpecifies the avatar representation that will be created when entering a WebXR session.
Can be a reference to a 3D model or a boolean to use the default avatar.
Reference to the GameObject this component is attached to This is a three.js Object3D with additional GameObject functionality
Unique identifier for this component instance, used for finding and tracking components
When enabled, 3D models representing the user's VR controllers will be automatically created and rendered in the scene.
When enabled, 3D models representing the user's hands will be automatically created and rendered when hand tracking is available.
Optional
sourceIdentifier for the source asset that created this component. For example, URL to the glTF file this component was loaded from
When enabled, default movement controls will be automatically added to the scene when entering VR.
This includes teleportation and smooth locomotion options for VR controllers.
Experimental
useWhen enabled, the 'depth-sensing' WebXR feature will be requested to provide real-time depth occlusion.
Currently only supported on Oculus Quest devices.
When enabled, users can adjust the position, rotation, and scale of the AR scene with one or two fingers after initial placement.
When enabled, a reticle will be displayed to help place the scene in AR. The user must tap on a detected surface to position the scene.
When enabled, a USDZExporter component will be automatically added to the scene if none is found.
This allows iOS and visionOS devices to view 3D content using Apple's AR QuickLook.
When enabled, a SpatialGrabRaycaster will be added or enabled in the scene,
allowing users to interact with objects at a distance in VR/AR.
Experimental
useXRAnchorWhen enabled, an XRAnchor will be created for the AR scene and its position will be regularly updated to match the anchor.
This can help with spatial persistence in AR experiences.
Checks if this component is currently active (enabled and part of an active GameObject hierarchy) Components that are inactive won't receive lifecycle method calls
True if the component is enabled and all parent GameObjects are active
While AR: this will return the currently active WebARSessionRoot component.
You can also query this component in your scene with findObjectOfType(WebARSessionRoot)
Checks if this component has been destroyed
True if the component or its GameObject has been destroyed
Controls whether this component is enabled Disabled components don't receive lifecycle callbacks
Gets the forward direction vector (0,0,-1) of this component's GameObject in world space
The layer value of the GameObject this component is attached to Used for visibility and physics filtering
The name of the GameObject this component is attached to Used for debugging and finding objects
Gets the right direction vector (1,0,0) of this component's GameObject in world space
Shorthand accessor for the current scene from the context
The scene this component belongs to
the currently active webxr input session
immersive-vr or immersive-ar
Indicates whether the GameObject is marked as static Static objects typically don't move and can be optimized by the engine
The tag of the GameObject this component is attached to Used for categorizing objects and efficient lookup
Gets the up direction vector (0,1,0) of this component's GameObject in world space
Gets the rotation of this component's GameObject in world space as a quaternion
Sets the rotation of this component's GameObject in world space using a quaternion
The world rotation quaternion to set
Protected
createCreates and instantiates the user's avatar representation in the WebXR session.
The active session
Destroys this component and removes it from its GameObject After destruction, the component will no longer receive lifecycle callbacks
Dispatches an event to all registered listeners
The event object to dispatch
Always returns false (standard implementation of EventTarget)
Optional
earlyCalled at the beginning of each frame before regular updates. Use for logic that needs to run before standard update callbacks.
Call to start an WebAR session
This is a shorthand for NeedleXRSession.start("immersive-ar", init, this.context)
Optional
init: XRSessionInitCall to start an WebVR session.
This is a shorthand for NeedleXRSession.start("immersive-vr", init, this.context)
Optional
init: XRSessionInitCall to end a WebXR (AR or VR) session.
This is a shorthand for NeedleXRSession.stop()
use getButtonsFactory or directly access WebXRButtonFactory.getOrCreate
Returns the WebXR button factory, creating one if it doesn't exist. Use this to access and modify WebXR UI buttons.
The WebXRButtonFactory instance
Optional
lateCalled after all update functions have been called. Use for calculations that depend on other components being updated first.
Optional
onCalled after the scene has been rendered. Use for post-processing or UI updates that should happen after rendering
Optional
onCalled immediately before the scene is rendered.
Current XRFrame if in an XR session, null otherwise
Optional
onCalled when this component's collider begins colliding with another collider.
Information about the collision that occurred
Optional
onCalled when this component's collider stops colliding with another collider.
Information about the collision that ended
Optional
onCalled each frame while this component's collider is colliding with another collider
Information about the ongoing collision
Called when the component is destroyed. Use for cleanup operations like removing event listeners
Optional
onCalled when the context's pause state changes.
Whether the context is currently paused
The previous pause state
Optional
onCalled when a pointer completes a click interaction with this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer button is pressed while over this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer enters this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer exits this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer moves while over this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer button is released while over this component's GameObject
Data about the pointer event
Optional
onCalled when this component's trigger collider is entered by another collider
The collider that entered this trigger
Optional
onCalled when another collider exits this component's trigger collider
The collider that exited this trigger
Optional
onCalled each frame while another collider is inside this component's trigger collider
The collider that is inside this trigger
Optional
onCalled when a field decorated with @validate() is modified.
Optional
prop: stringThe name of the field that was changed
Optional
onXRControllerCalled when an XR controller is connected or when this component becomes active in a session with existing controllers
Event data for the controller that was added
Optional
onXRControllerCalled when an XR controller is disconnected or when this component becomes inactive during a session with controllers
Event data for the controller that was removed
Optional
resolveCalled when this component needs to remap guids after an instantiate operation.
Mapping from old guids to newly generated guids
Call to enable or disable default controller rendering
Call to enable or disable default controller behaviour
Sets the position of this component's GameObject in world space using individual coordinates
X-coordinate in world space
Y-coordinate in world space
Z-coordinate in world space
Sets the rotation of this component's GameObject in world space using quaternion components
X component of the quaternion
Y component of the quaternion
Z component of the quaternion
W component of the quaternion
Sets the rotation of this component's GameObject in world space using individual Euler angles
X-axis rotation
Y-axis rotation
Z-axis rotation
Whether the values are in degrees (true) or radians (false)
Optional
startCalled once at the beginning of the first frame after the component is enabled. Use for initialization that requires other components to be awake.
Starts a coroutine that can yield to wait for events. Coroutines allow for time-based sequencing of operations without blocking. Coroutines are based on generator functions, a JavaScript language feature.
Generator function to start
Event to register the coroutine for (default: FrameEvent.Update)
The generator function that can be used to stop the coroutine
Stops a coroutine that was previously started with startCoroutine
The routine to be stopped
The frame event the routine was registered with
Optional
supportsXRDetermines if this component supports a specific XR mode
The XR session mode to check support for
True if the component supports the specified mode
Optional
updateCalled once per frame during the main update loop. The primary location for frame-based game logic.
WebXR component to enable VR, AR and Quicklook on iOS in your scene.
It provides a simple wrapper around the NeedleXRSession API and adds some additional features like creating buttons or enabling default movement behaviour.