How to fix real free camera matrices in Immersice-AR

I am creating a simple glb viewer for immersive AR, and I noticed that the world matrices or real world coordinates are messed up, I simply want to rotate the model on Y-axis after placing them using hittest, it works in first try and second try in immersive -ar but after third try, the y axis tilted in real world, here is my project link, Babylon.js Playground

If you want to rotate an object around the world Y axis, you should not rotate it on it’s local Y axis.
You can use the .rotate function using WORLD coordinates, which is documented here:

Also note that when setting a new .rotation vector3 you are eliminating the original rotation quaternion, which is (IMO) not the best way to go. The model you are loading might have already a transformation (which you are resetting in line 19 - i would remove that as well). You don’t want to reset its rotation, you want to add to it.

2 Likes

i see, thanks for the suggestion, I will try this out ,