Home > OS >  Unity 3D: Change rotation with normalized vector3
Unity 3D: Change rotation with normalized vector3

Time:12-20

Right now it seems the only way to rotate a game object is to input the rotation based on degrees. Is there a way to rotate a game object using a normalized Vector3, where its x,y,z are between -1 and 1.

I have tried just multiplying the Vector3 by 90 instead which seems to work. But I was wondering if there is a better solution.

CodePudding user response:

From what you describe it sounds like you simply want to do e.g.

transform.forward = directionVector;

or you could also use Quaternion.LookRotation

transform.rotation = Quaternion.LookRotation(directionVector);
  • Related