Used when usePlacementReticle
is enabled. This is the scale of the user in the scene in AR. Larger values make the 3D content appear smaller
When enabled the AR session root center will be automatically adjusted to place the center of the scene
When enabled the scene will be placed automatically when a point in the real world is found
When enabled a button will be added to the UI to enter AR
When enabled a QRCode will be created to open the website on a mobile device
When enabled a send to quest button will be shown if the device does not support VR
When enabled a button will be added to the UI to enter VR
Optional
customARPlacementWhen assigned this object will be used as the AR placement reticle
Optional
defaultThis avatar representation will be spawned when you enter a webxr session
the object this component is attached to. Note that this is a threejs Object3D with some additional features
the unique identifier for this component
When enabled controller models will automatically be created and updated when you are using controllers in WebXR
When enabled hand models will automatically be created and updated when you are using hands in WebXR
Optional
sourceholds the source identifier this object was created with/from (e.g. if it was part of a glTF file the sourceId holds the url to the glTF)
When enabled default movement behaviour will be added
Preview feature enabling occlusion (when available: https://github.com/cabanier/three.js/commit/b6ee92bcd8f20718c186120b7f19a3b68a1d4e47) Enables the 'depth-sensing' WebXR feature to provide realtime depth occlusion. Only supported on Oculus Quest right now.
When enabled you can position, rotate or scale your AR scene with one or two fingers
When enabled the scene must be placed in AR
When enabled a USDZExporter component will be added to the scene (if none is found)
When enabled the spatial grab raycaster will be added or enabled in the scene
Experimental: When enabled an XRAnchor will be created for the AR scene and the position will be updated to the anchor position every few frames
true if the object is enabled and active in the hierarchy
true if this component was destroyed (this.destroy()
) or the whole object this component was part of
the layer of the gameObject this component is attached to
the name of the gameObject this component is attached to
shorthand for this.context.scene
the scene of the context
the currently active webxr input session
immersive-vr or immersive-ar
Is the gameObject marked as static
the tag of the gameObject this component is attached to
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
Protected
createDispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
Optional
earlyCall to start an WebAR session
Optional
init: XRSessionInitCall to start an WebVR session
Optional
init: XRSessionInitCalling this function will get the Needle WebXR button factory (it will be created if it doesnt exist yet)
the Needle WebXR button factory
Optional
lateOptional
onOptional
onOptional
onOptional
onOptional
onCallback when this component joins a xr session (or becomes active in a running XR session)
Optional
onOptional
onCalled when an object (or any child object) is clicked (needs a EventSystem in the scene)
Optional
onCalled when a button is started to being pressed on an object (or a child object)
Optional
onCalled when a pointer (mouse, touch, xr controller) starts pointing on/hovering an object (or a child object)
Optional
onCalled when a pointer (mouse, touch, xr controller) exists an object (it was hovering the object before but now it's not anymore)
Optional
onCalled when a pointer (mouse, touch, xr controller) is moving over an object (or a child object)
Optional
onCalled when a button is released (which was previously pressed in onPointerDown
)
Optional
onOptional
onOptional
onCallback when a xr session updates (while it is still active in XR session)
Optional
onOptional
onXRControllerCallback when a controller is connected/added while in a XR session
OR when the component joins a running XR session that has already connected controllers
OR when the component becomes active during a running XR session that has already connected controllers
Optional
onXRControllerOptional
resolveCall to enable or disable default controller rendering
Call to enable or disable default controller behaviour
Optional
startstarts a coroutine (javascript generator function)
yield
will wait for the next frame:
yield WaitForSeconds(1)
to wait for 1 second.yield WaitForFrames(10)
to wait for 10 frames.yield new Promise(...)
to wait for a promise to resolve.generator function to start
event to register the coroutine for (default: FrameEvent.Update). Note that all coroutine FrameEvent callbacks are invoked after the matching regular component callbacks. For example FrameEvent.Update
will be called after regular component update()
methods)
the generator function (use it to stop the coroutine with stopCoroutine
)
Stop a coroutine that was previously started with startCoroutine
the routine to be stopped
the frame event to unregister the routine from (default: FrameEvent.Update)
Optional
supportsXROptional callback, you can implement this to only get callbacks for VR or AR sessions if necessary.
true if the mode is supported (if false the mode is not supported by this component and it will not receive XR callbacks for this mode)
Optional
update
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.