Skip to content

Commit

Permalink
Fix hand meshes not displaying when hands are emulating controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
toji committed May 22, 2024
1 parent e16b4ef commit 26acbbc
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ function addAssetSceneToControllerModel( controllerModel, scene ) {

scene.traverse( ( child ) => {

// This only really applies to the hand mesh. If a hand is loaded as a
// controller rather than a skinned mesh the lack of joint data will cause
// it to render as a crumpled up ball at the origin. Discarding skinning
// prevents this. (All other XR controller animation is handled separately
// from Three's skinning system.)
if ( child.isSkinnedMesh ) {

child.isSkinnedMesh = false;

}

if ( child.isMesh ) {

child.material.envMap = controllerModel.envMap;
Expand Down Expand Up @@ -231,7 +242,7 @@ class XRControllerModelFactory {

const xrInputSource = event.data;

if ( xrInputSource.targetRayMode !== 'tracked-pointer' || ! xrInputSource.gamepad ) return;
if ( xrInputSource.targetRayMode !== 'tracked-pointer' || ! xrInputSource.gamepad || xrInputSource.hand ) return;

fetchProfile( xrInputSource, this.path, DEFAULT_PROFILE ).then( ( { profile, assetPath } ) => {

Expand Down

0 comments on commit 26acbbc

Please sign in to comment.