Allows to create controller models for WebXR controllers that can be added as a visual representation to your scene. XRControllerModelFactory will automatically fetch controller models that match what the user is holding as closely as possible. The models should be attached to the object returned from getControllerGrip in order to match the orientation of the held device.
This module depends on the motion-controllers third-part library.
const controllerModelFactory = new XRControllerModelFactory();
const controllerGrip = renderer.xr.getControllerGrip( 0 );
controllerGrip.add( controllerModelFactory.createControllerModel( controllerGrip ) );
scene.add( controllerGrip );
XRControllerModelFactory is an addon, and must be imported explicitly, see Installation#Addons.
import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js';
Constructs a new XR controller model factory.
gltfLoader
A glTF loader that is used to load controller models.
Default is null.
onLoad
A callback that is executed when a controller model has been loaded.
Default is null.
A glTF loader that is used to load controller models.
Default is null.
A callback that is executed when a controller model has been loaded.
Default is null.
The path to the model repository.
Creates a controller model for the given WebXR controller.
controller
The controller.
Returns: The XR controller model.
Sets the path to the model repository.
path
The path to set.
Returns: A reference to this instance.