What is the opposite of Quaternion * Vector3


DestinationVector3 = RotationQuaternion * SourceVector3

What would be:

RotationQuaternion = DestinationVector3 ??? SourceVector3

Technically, there is no opposite, since Q*V loses information about the “up” position.

For example, if Q rotates 45 degrees right and also spins you on Z, then Q*forwards is just a vector pointing 45 degrees right (0.7,0,0.7). There’s no Z-spin in those numbers. If you FromTo that, you get back a quat that just points 45 degrees right. No spin.

The script reference is your friend.

function SetFromToRotation (fromDirection : Vector3, toDirection : Vector3) : void

Creates a rotation which rotates from fromDirection to toDirection.

It’s Quaternion.FromToRotation:

var rot: Quaternion = Quaternion.FromToRotation(SourceVector, DestVector);

There are infinite possible rotations that rotate SourceVector to DestVector - this method returns the shortest one.