Documentation

Unity Engine

Download Unity

Unity Engine

swingtwist(quaternion, float3, out quaternion, out quaternion)

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

Definition

swingtwist(quaternion, float3, quaternion, quaternion)

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

Parameters

The unit quaternion to decompose.

twistAxis

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

The swing rotation.

The twist rotation around twistAxis.

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.twistswing to decompose in the other order.