---
title: FromToRotationSafe(float3, float3)
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/quaternion/fromtorotationsafe
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/mathematics/quaternion/fromtorotationsafe.md
last_updated: 2026-11-20
generated_at: 2026-11-26T09:25:32.302Z
locale: en-us
---

# FromToRotationSafe(float3, float3)

> Returns a quaternion that rotates the direction from onto the direction to. The two input vectors are not assumed to be unit length. If the magnitude of either of the vectors is so extreme that the calculation cannot be carried out reliably, the identity will be returned instead. If the vectors are within about 1.4e-3 radians of pointing in opposite directions, the result is a half turn around an axis perpendicular to from.

## Definition

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

```csharp
public static quaternion FromToRotationSafe(float3 from, float3 to)
```

### Parameters

**** (\[float3]\(/engine/7000.0/script-reference/unity/mathematics/float3)): The direction to rotate from.**** (\[float3]\(/engine/7000.0/script-reference/unity/mathematics/float3)): The direction to rotate to.

### Returns

| Type                                                                          | Description                                                                |
| ----------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [quaternion](/engine/7000.0/script-reference/unity/mathematics/quaternion.md) | The unit quaternion that rotates from onto to, or the identity quaternion. |
