---
title: swingtwist(quaternion, float3, out quaternion, out quaternion)
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/mathematics/math/swingtwist
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/mathematics/math/swingtwist.md
last_updated: 2026-11-20
generated_at: 2026-11-25T22:12:40.653Z
locale: en-us
---

# 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).

## Definition

* **Type:** Method
* **Namespace:** [Unity.Mathematics](/engine/7000.0/script-reference/unity/mathematics.md)
* **Assembly:** UnityEngine.MathematicsModule

## swingtwist(quaternion, float3, quaternion, quaternion)

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

### Parameters

**** (\[quaternion]\(/engine/7000.0/script-reference/unity/mathematics/quaternion)): The unit quaternion to decompose.**** (\[float3]\(/engine/7000.0/script-reference/unity/mathematics/float3)): The axis to twist around. It doesn't need to be unit length.**** (\[quaternion]\(/engine/7000.0/script-reference/unity/mathematics/quaternion)): The swing rotation.**** (\[quaternion]\(/engine/7000.0/script-reference/unity/mathematics/quaternion)): 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](/engine/7000.0/script-reference/unity/mathematics/math/twistswing.md) to decompose in the other order.
