Documentation

Unity Engine

Download Unity

Unity Engine

twistswing(quaternion, float3, out quaternion, out quaternion)

Decomposes a unit quaternion into a twist rotation around the given axis and a swing rotation, so that q equals mul(twist, swing).
Read time 1 minuteLast updated 5 days ago

Definition

twistswing(quaternion, float3, quaternion, quaternion)

public static void twistswing(quaternion q, float3 twistAxis, out quaternion twist, out quaternion swing)

Parameters

The unit quaternion to decompose.

twistAxis

The axis to twist around. It doesn't need to be unit length.

The twist rotation around twistAxis.

The swing rotation.

Remarks

The twist is the part of q that rotates around twistAxis and the swing is the remaining rotation, whose axis is perpendicular to twistAxis. Use math.swingtwist to decompose in the other order.