# TryGetPlaneMatrix2D(Matrix4x4, TransformPlane, out Matrix4x4)

> Try to get a matrix suitable for use with PhysicsMath.GetRelativeMatrix2D or PhysicsMath.GetRelativePose2D from the specified matrix, ignoring its scale on the transform plane's out-of-plane axis.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

## TryGetPlaneMatrix2D(Matrix4x4, TransformPlane, Matrix4x4)

```csharp
public static bool TryGetPlaneMatrix2D(Matrix4x4 matrix, PhysicsWorld.TransformPlane transformPlane, out Matrix4x4 planeMatrix)
```

### Parameters

**** (\[Matrix4x4]\(/engine/6000.7/script-reference/unityengine/matrix4x4)): The matrix to build from.**** (\[TransformPlane]\(/engine/6000.7/script-reference/unity/u2d/physics/physicsworld/transformplane)): The transform plane to use.**** (\[Matrix4x4]\(/engine/6000.7/script-reference/unityengine/matrix4x4)): The resulting matrix, or the default matrix if this returns false.

### Returns

| Type                                                          | Description                                                                                                        |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Whether a valid matrix was calculated. Returns false when the matrix has an in-plane axis too small to build from. |

### Remarks

A matrix whose out-of-plane scale is at or near zero, such as one built from flattened 2D data, is rebuilt with that axis treated as one; left as zero it makes the whole matrix singular, and inverting it later would produce a NaN result. A negative out-of-plane scale is treated the same way, since its sign and magnitude have no meaning in 2D and left as-is it turns the extracted rotation into NaN instead.
