Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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);