Duplicate InstancedMesh WebXR Hand Points Upon VR Re-Entry

Reproduce using the example from the hand tracking documentation:
Babylon.js Playground (babylonjs.com)

  1. Enable the inspector and pop it out.
  2. Enter VR using Meta’s Immersive Web Emulator or a real device. The issue occurs with both.
  3. Exit VR. With the emulator, press the small quit button.
  4. Re-enter VR.
  5. Look at the inspector.
  6. The InstancedMesh WebXR hand points were not disposed of before re-entering VR mode. As a result, there are now four index-finger-metacarpal, four jointParent, two left-handJoint-0, two right-handJoint-0, etc.

Thanks a lot, will check that and get back to you. the instances are being disposed, but duplication still occurs.

Just an update - reproduced, I will work on a fix. Thanks a lot of reporting and I promise a swift resolution in a week or two (as I will be away…)

1 Like

It’s not an urgent bug for me.
I noticed that when I called scene.getMeshByName("left-handJoint-0") after re-entering VR, it returned the wrong InstancedMesh.
I fixed the issue by calling webXRHand.getJointMesh(WebXRHandJoint.WRIST) instead, as it finds the correct instance. Also, it’s a better way to find the joint anyway.

1 Like

Addressed here - Better resource handling when attaching/detaching webxr hands by RaananW · Pull Request #15531 · BabylonJS/Babylon.js (github.com)

1 Like