Hey there,
I want to acces the Hand Mesh. I do that with this code:
const xrHandFeature = xrHelper.featuresManager.getEnabledFeature(WebXRFeatureName.HAND_TRACKING) as WebXRHandTracking;
xrHandFeature.onHandAddedObservable.add((newHand) => {
// newHand.handMesh // Access handMesh here!
});
Sometimes the handMesh
is undefined. I think thats because the hand mesh is not loaded yet. Is there a callback when the handMesh is loaded? There is a callback when a controller Mesh is loaded but this wont trigger for hand meshes. I tried this code:
input.onControllerAddedObservable.add((controller) => {
controller.onMotionControllerInitObservable.add((motionController) => {
motionController.onModelLoadedObservable.add(() => {
const xrHandFeature = xrHelper!.featuresManager.getEnabledFeature(WebXRFeatureName.HAND_TRACKING) as WebXRHandTracking;
let newHand = xrHandFeature.getHandByHandedness("left");
if(!newHand)
xrHandFeature.getHandByHandedness("right");
// newHand!.handMesh // Access Hand Mesh here!
});
});
});
Its also really complicated to get the WebXRHand from a WebXRInputSource. You can acces the XRHand via controller.inputSource.hand
but you wont get acces to the WebXRHand. Thats why I have this awkward code where I check for left or right hand. Maybe there is a more elegant way of accessing it which I dont see.
Thank you!