# GetRelativeMatrix2D(in Matrix4x4, in Matrix4x4, TransformPlane, in TransformPlaneCustom, bool)

> Get the relative transformation matrix between the two specified transform matrix using the specified transform plane to transform into 2D space i.e. XY position and Z rotation.

## Definition

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

## GetRelativeMatrix2D(Matrix4x4, Matrix4x4, TransformPlane, TransformPlaneCustom, bool)

```csharp
public static Matrix4x4 GetRelativeMatrix2D(in Matrix4x4 transformFrom, in Matrix4x4 transformTo, PhysicsWorld.TransformPlane transformPlane, in PhysicsWorld.TransformPlaneCustom transformPlaneCustom, bool useScale = true)
```

### Parameters

**** (\[Matrix4x4]\(/engine/6000.6/script-reference/unityengine/matrix4x4)): The transform used as a reference to transform from.**** (\[Matrix4x4]\(/engine/6000.6/script-reference/unityengine/matrix4x4)): The transform used as a reference to transform to.**** (\[TransformPlane]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsworld/transformplane)): The transform plane to use.**** (\[TransformPlaneCustom]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsworld/transformplanecustom)): The custom transform plane to use (if required).**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): If the returned matrix should include scale. Scale is not relative and always uses the transformTo lossyScale.

### Returns

| Type                                                                  | Description                                    |
| --------------------------------------------------------------------- | ---------------------------------------------- |
| [Matrix4x4](/engine/6000.6/script-reference/unityengine/matrix4x4.md) | The calculated relative transformation matrix. |
