It’s been a little while, just checking in. It looks like a lot of progress has been made on the
BABYLON.WebXRFeatureName.HAND_TRACKING
It’s a very cool looking hand model! I would like to borrow that hand tracking feature’s mesh as the hand displayed in non hand-tracking mode (i.e. in lieu of regular Quest 1 controllers).
Here is my plan:
- I will hide the default controller profile mesh.
- I will then load the model for the hand-tracking feature and parent it to the position of the hand controllers.
- I will add some observers to the component button values and trigger/grip squeeze intensities and bend the bones in the hands accordingly to approximate the pose of making a fist or pointing etc.
I’m a bit stuck on step one. I know that I can use this option to prevent loading any hand controller at all…:
createDefaultXRExperienceAsync({
inputOptions: {
doNotLoadControllerMeshes: true,
},
});
However, I don’t think that’s what I want because that prevents the onModelLoadedObservable
and onMeshLoadedObservable
callbacks from executing. And I rely on the loaded mesh to get the position and rotation of the hand:
inputSource.grip.onAfterWorldMatrixUpdateObservable.add(grip => {
// get pos and rotation of this grip thing,
// it is my controller's hand pos and rot
})
Unless there is a better way of getting the hand positions and rotations, I need to keep the default model loading and just hide it after it has loaded. I also parent a little hand menu to the left controller.
Next I tried hiding the hand controller model inside the onModelLoadedObservable
callback. The problem there is it is not obvious what mesh I need to hide. There seems to be more than one mesh/transform node, and there is a hierarchy of different buttons and parts. So what I did is get the thing called ‘grip’, e.g. named ‘controller-0-tracked-pointer-right-grip’
And then map over all its child mesh descendants and set all visibility to zero or setEnabled(false). For some reason, even though the properties are correctly set on all the children, they are still visible in the scene. It did disappear if I put in a bit of delay using setTimeout, but didn’t work without a delay. Seemed like there might be a race condition somewhere, as if setting visibility or setEnabled to false before the children were fully loaded was unable to correctly hide them. ![:man_shrugging: :man_shrugging:](https://emoji.discourse-cdn.com/win10/man_shrugging.png?v=12)
However this delay isn’t a good idea, because the timing is arbitrary, and as I said I was trying to parent a little menu to my left hand, and if I hide all the descendants of the ‘grip’ after an arbitrary delay then the menu I bound to the hand gets hidden too.
Do y’all have any suggestions?