[XR] Reattaching teleportation is not working

When reattaching the teleportation feature after detaching it, the teleportation will not work.
https://playground.babylonjs.com/#LS4JSW#8

Adding @RaananW

It seems to my like the isDetached is initialized incorrectly. A feature only attaches when a session starts, and can technically only be detached during a session. It will of course work outside, but your initiail state is “isDetached = true” until the session starts. it is then attached (when the session starts)

I’m not sure if I understand. The attach/detach functions are called during the session through the 3D button and the isDetached variable is a simple boolean initialized with false. I also logged the function calls and they are as expected. On first button click teleportation.detach() is executed, on second click the .attach() function. The detaching works, as you can’t teleport anymore, when clicking again, the attach function is being called, but the teleportation remains disabled.

https://playground.babylonjs.com/#LS4JSW#10 This is an example where isDetached is initialized outside of the createScene function. I get the same results in both examples.

I will look into that. I had to pack my quest for a few days, it is now ready on my desk :slight_smile:

2 Likes

Bug found! thanks a lot! you can follow here - [XR] teleportation re-attachment is not working correctly · Issue #9273 · BabylonJS/Babylon.js · GitHub

2 Likes