Inverse of transform.forward as quaternion?

How can I calculate the inverse of a transform.forward as a quaternion? I can’t seem to figure out the order of operations I need.

Basically, if an object is facing world right, I’d like a quaternion that is facing world left… and every other configuration imaginable.

Quaternions do not describe a pointing direction, they describe rotation
Maybe you want the rotation needed to move an object from facing identity (0,0,0) to facing your direction?
If so, you can just use LookRotation along the direction
If you want a rotation to move an object from facing on x to -x, you can use FromToRotation

1 Like

I’d go with something like

transform.rotation = Quaternion.LookRotation(-transform.forward);

And maybe, if you need it, specify the up direction as second parameter.

3 Likes