---
title: twistswing(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/twistswing
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/mathematics/math/twistswing.md
last_updated: 2026-11-20
generated_at: 2026-11-25T22:12:37.785Z
locale: en-us
---

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

## Definition

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

## twistswing(quaternion, float3, quaternion, quaternion)

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

### 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 twist rotation around twistAxis.**** (\[quaternion]\(/engine/7000.0/script-reference/unity/mathematics/quaternion)): 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](/engine/7000.0/script-reference/unity/mathematics/math/swingtwist.md) to decompose in the other order.
