Capítulo 633 de 859

Chapter 633: XRHandModelFactory

Core Idea

Similar to XRControllerModelFactory, this class allows to create hand models for WebXR controllers that can be added as a visual representation to your scene.

Key Concepts

  • gltfLoader : GLTFLoader: A glTF loader that is used to load hand models.
  • onLoad : function: A callback that is executed when a hand model has been loaded.
  • path : string: The path to the model repository.

Code Examples

const handModelFactory = new XRHandModelFactory();
const hand = renderer.xr.getHand( 0 );
hand.add( handModelFactory.createHandModel( hand ) );
scene.add( hand );
  • What it demonstrates: Typical usage of XRHandModelFactory.

Reference Tables

Constructor

Signature
new XRHandModelFactory( gltfLoader : GLTFLoader, onLoad : function )

Properties

PropertyDescription
.gltfLoader : GLTFLoaderA glTF loader that is used to load hand models.
.onLoad : functionA callback that is executed when a hand model has been loaded.
.path : stringThe path to the model repository.

Methods

MethodDescription
`.createHandModel( controller : Group, profile : 'spheres''boxes'
.setPath( path : string ) : XRHandModelFactorySets the path to the hand model repository.

Key Takeaways

  1. Most relevant properties: gltfLoader, onLoad, path.
  2. Key methods: createHandModel, setPath.

Connects To