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

# projectonplanesafe

> Returns the projection of a onto the line through the origin that is perpendicular to planeNormal. If the result is not finite, returns the default value instead.

## Definition

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

## projectonplanesafe(float2, float2, float2)

Returns the projection of a onto the line through the origin that is perpendicular to planeNormal. If the result is not finite, returns the default value instead.

```csharp
public static float2 projectonplanesafe(float2 a, float2 planeNormal, float2 defaultValue = default)
```

### Parameters

**** (\[float2]\(/engine/7000.0/script-reference/unity/mathematics/float2)): Vector to project.**** (\[float2]\(/engine/7000.0/script-reference/unity/mathematics/float2)): Non-zero normal of the line to project onto.**** (\[float2]\(/engine/7000.0/script-reference/unity/mathematics/float2)): Default value to return if the projection is not finite.

### Returns

| Type                                                                  | Description                                                                           |
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [float2](/engine/7000.0/script-reference/unity/mathematics/float2.md) | The projection of a onto the line perpendicular to planeNormal, or the default value. |

### Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call [math.projectonplane](/engine/7000.0/script-reference/unity/mathematics/math/projectonplane.md) instead which is faster than this function.

## projectonplanesafe(float3, float3, float3)

Returns the projection of a onto the plane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.

```csharp
public static float3 projectonplanesafe(float3 a, float3 planeNormal, float3 defaultValue = default)
```

### Parameters

**** (\[float3]\(/engine/7000.0/script-reference/unity/mathematics/float3)): Vector to project.**** (\[float3]\(/engine/7000.0/script-reference/unity/mathematics/float3)): Non-zero normal of the plane to project onto.**** (\[float3]\(/engine/7000.0/script-reference/unity/mathematics/float3)): Default value to return if the projection is not finite.

### Returns

| Type                                                                  | Description                                               |
| --------------------------------------------------------------------- | --------------------------------------------------------- |
| [float3](/engine/7000.0/script-reference/unity/mathematics/float3.md) | The projection of a onto the plane, or the default value. |

### Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call [math.projectonplane](/engine/7000.0/script-reference/unity/mathematics/math/projectonplane.md) instead which is faster than this function.

## projectonplanesafe(float4, float4, float4)

Returns the projection of a onto the hyperplane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.

```csharp
public static float4 projectonplanesafe(float4 a, float4 planeNormal, float4 defaultValue = default)
```

### Parameters

**** (\[float4]\(/engine/7000.0/script-reference/unity/mathematics/float4)): Vector to project.**** (\[float4]\(/engine/7000.0/script-reference/unity/mathematics/float4)): Non-zero normal of the hyperplane to project onto.**** (\[float4]\(/engine/7000.0/script-reference/unity/mathematics/float4)): Default value to return if the projection is not finite.

### Returns

| Type                                                                  | Description                                                    |
| --------------------------------------------------------------------- | -------------------------------------------------------------- |
| [float4](/engine/7000.0/script-reference/unity/mathematics/float4.md) | The projection of a onto the hyperplane, or the default value. |

### Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call [math.projectonplane](/engine/7000.0/script-reference/unity/mathematics/math/projectonplane.md) instead which is faster than this function.

## projectonplanesafe(double2, double2, double2)

Returns the projection of a onto the line through the origin that is perpendicular to planeNormal. If the result is not finite, returns the default value instead.

```csharp
public static double2 projectonplanesafe(double2 a, double2 planeNormal, double2 defaultValue = default)
```

### Parameters

**** (\[double2]\(/engine/7000.0/script-reference/unity/mathematics/double2)): Vector to project.**** (\[double2]\(/engine/7000.0/script-reference/unity/mathematics/double2)): Non-zero normal of the line to project onto.**** (\[double2]\(/engine/7000.0/script-reference/unity/mathematics/double2)): Default value to return if the projection is not finite.

### Returns

| Type                                                                    | Description                                                                           |
| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [double2](/engine/7000.0/script-reference/unity/mathematics/double2.md) | The projection of a onto the line perpendicular to planeNormal, or the default value. |

### Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call [math.projectonplane](/engine/7000.0/script-reference/unity/mathematics/math/projectonplane.md) instead which is faster than this function.

## projectonplanesafe(double3, double3, double3)

Returns the projection of a onto the plane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.

```csharp
public static double3 projectonplanesafe(double3 a, double3 planeNormal, double3 defaultValue = default)
```

### Parameters

**** (\[double3]\(/engine/7000.0/script-reference/unity/mathematics/double3)): Vector to project.**** (\[double3]\(/engine/7000.0/script-reference/unity/mathematics/double3)): Non-zero normal of the plane to project onto.**** (\[double3]\(/engine/7000.0/script-reference/unity/mathematics/double3)): Default value to return if the projection is not finite.

### Returns

| Type                                                                    | Description                                               |
| ----------------------------------------------------------------------- | --------------------------------------------------------- |
| [double3](/engine/7000.0/script-reference/unity/mathematics/double3.md) | The projection of a onto the plane, or the default value. |

### Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call [math.projectonplane](/engine/7000.0/script-reference/unity/mathematics/math/projectonplane.md) instead which is faster than this function.

## projectonplanesafe(double4, double4, double4)

Returns the projection of a onto the hyperplane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.

```csharp
public static double4 projectonplanesafe(double4 a, double4 planeNormal, double4 defaultValue = default)
```

### Parameters

**** (\[double4]\(/engine/7000.0/script-reference/unity/mathematics/double4)): Vector to project.**** (\[double4]\(/engine/7000.0/script-reference/unity/mathematics/double4)): Non-zero normal of the hyperplane to project onto.**** (\[double4]\(/engine/7000.0/script-reference/unity/mathematics/double4)): Default value to return if the projection is not finite.

### Returns

| Type                                                                    | Description                                                    |
| ----------------------------------------------------------------------- | -------------------------------------------------------------- |
| [double4](/engine/7000.0/script-reference/unity/mathematics/double4.md) | The projection of a onto the hyperplane, or the default value. |

### Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call [math.projectonplane](/engine/7000.0/script-reference/unity/mathematics/math/projectonplane.md) instead which is faster than this function.
