Quaternion.LookRotation() doesn't look down

So i have a turret that i want to point towards a certain target (for now, my mouse), and i got it working by simply doing this:

pitchObject.Rotate(new Vector3(-90, 90, 0));

This is the result: 1

Now, the problem is that i don’t want to have to apply it to the turret directly, i want to have it in a quaternion so that i can use Quaternion.Lerp(), so i tried this:

Vector3 direction = target - transform.position;
Quaternion quat = Quaternion.LookRotation(direction);
quat *= Quaternion.Euler(-90, 90, 0);
pitchObject.rotation = quat;

But then suddenly it can no longer look down, as seen here.

Would someone be able to explain to me why this happens? And maybe if i’m doing something else wrong. :slight_smile:

By doing quat *= Quaternion.Euler(-90,90,0); you are only adding the two together. Your problem seems to be with the X-axis, so my guess is that you are clamping the X-axis to -90, because if target never becomes negative, then the X-axis will never get below -90.

Realized what was wrong, i was doing the direction from the bottom of the turret, not the barrels of it, therefore the target was always at the same level or above.