Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
AnmaaVR's avatar
AnmaaVR
Member
1 year ago

OVR Camera rig won't reset

I have a cube as a reset position located in x:0 y:0 z:0.

I am trying to player to move to the reset position after collision enter. The collision works but the player is not moving to the reset position.
I am using OVR Camera rig. Any idea how I can solve this?

  [SerializeField] Transform resetTransform;
  [SerializeField] GameObject player;
  [SerializeField] Camera playerHead;    

public void ResetPosition()
    {
        var rotationAngleY = playerHead.transform.rotation.eulerAngles.y - resetTransform.transform.rotation.y;
        player.transform.Rotate(0, -rotationAngleY, 0);
        var distanceDiff = resetTransform.position - playerHead.transform.position;
        player.transform.position += distanceDiff;
    }


 

No RepliesBe the first to reply