Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Always rotate Gameobject to the right site

Discussion in 'VR' started by martinK95, Jul 31, 2017.

  1. martinK95


    Jul 27, 2017
    Hello, im using an 3D-Arrow that is always in the Users Field of View at the Position of the Cursor and want it to turn right no matter where the User is looking at. I already played around a little with the Quaternion.LookRotation Method but couldn't make it show exactly to the right relative to the camera at every position.
    Anyone knows how i can correctly implement this?
  2. unity_andrewc


    Unity Technologies

    Dec 14, 2015
    That depends a bit on the way the model is oriented initially. An arbitrary arrow model could be pointing in any arbitrary direction when its rotation is set to just the identity quaternion.

    But once you've determined which way it's pointing in Unity space when its rotation is identity, it should be pretty straightforward. I'm pretty sure all you'd need to do is say:
    transform.rotation.SetFromToRotation(directionDeterminedBasedOnModel, Camera.transform.right);