So I have a VR app in which I can switch rooms simply by pushing these floating buttons. But now I’m trying to create a transition animation. My goal is to move the camera towards the button pushed. The problem is, I do not have coordinates for these buttons. I’ve made a website where the user can place these buttons themselves on a 2D surface and in Unity, their position is only based on their rotation (and 40 on posZ for their child object that is the image of the button). Here are some pics to demonstrate:
Buttons placed on 2d surface on the website
The buttons have rotations on X and Y axis to determine their position.
Also I’m not interested in moving towards the button in vertical direction, horizontal only. So if the button is for example too high the animation would just go below the button.
I’ve tried something like this:
cam.transform.position = Vector3.MoveTowards(cam.transform.position, target, speed * Time.deltaTime);
but I don’t know how to fill the variable target, how to create a Vector3 from the information I have.