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

# inversesafe(quaternion)

> Returns the inverse of a quaternion value, or the identity if the quaternion has zero length.

## Definition

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

```csharp
public static quaternion inversesafe(quaternion q)
```

### Parameters

**** (\[quaternion]\(/engine/7000.0/script-reference/unity/mathematics/quaternion)): The quaternion to invert.

### Returns

| Type                                                                          | Description                                                                 |
| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [quaternion](/engine/7000.0/script-reference/unity/mathematics/quaternion.md) | The quaternion inverse of the input quaternion, or the identity quaternion. |

### Remarks

Unlike [math.inverse](/engine/7000.0/script-reference/unity/mathematics/math/inverse.md), this function never divides by zero. A quaternion whose squared length isn't greater than [math.FLT\_MIN\_NORMAL](/engine/7000.0/script-reference/unity/mathematics/math/flt-min-normal.md) returns the identity.
