MathUtils.ShortestRotation

mail@pastecode.io avatar
unknown
csharp
3 years ago
264 B
292
Indexable
Never
public static Quaternion ShortestRotation(Quaternion to, Quaternion from)
{
    if (Quaternion.Dot(to, from) < 0)
    {
        return to * Quaternion.Inverse(Multiply(from, -1));
    }
    else
    {
        return to * Quaternion.Inverse(from);
    }
}