addAssetSceneToControllerModel function
void
addAssetSceneToControllerModel(
- XRControllerModel controllerModel,
- Object3D? scene
)
Implementation
void addAssetSceneToControllerModel(XRControllerModel controllerModel, Object3D? scene ) {
// Find the nodes needed for animation and cache them on the motionController.
findNodes( controllerModel.motionController!, scene );
// Apply any environment map that the mesh already has set.
if ( controllerModel.envMap != null) {
scene?.traverse( ( child ){
if ( child is Mesh ) {
child.material?.envMap = controllerModel.envMap;
child.material?.needsUpdate = true;
}
});
}
// Add the glTF scene to the controllerModel.
controllerModel.add( scene );
}