Rotate and move entity same as windows move and rotate in visionOS

Hi!

I am making an app where I have a scene with main entity in immersive space. Since my entity is fixed in space I added a reposition entity that allows users to reposition the whole entity in space. I use the drag gesture and translation to move the whole entity in x, y and z coordinates.

I wanted to implement the same behaviour that we have when we drag the window bar in visionOS windows. I tried using basic trigonometry and calculate entity rotation and translation relative to the movement but I am not getting the same movement and rotation as in visionOS windows.

Does anybody have a working solution for this? I would appreaciate it a lot. :)

Answered by Vision Pro Engineer in 784196022
Rotate and move entity same as windows move and rotate in visionOS
 
 
Q