Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetRelativeMatrix2D

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.
Read time 1 minuteLast updated 17 days ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

GetRelativeMatrix2D(Matrix4x4, Matrix4x4, TransformPlane, 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.
public static Matrix4x4 GetRelativeMatrix2D(in Matrix4x4 transformFrom, in Matrix4x4 transformTo, PhysicsWorld.TransformPlane transformPlane, in PhysicsWorld.TransformPlaneCustom transformPlaneCustom, bool useScale = true)

Parameters

transformFrom

The transform used as a reference to transform from.

transformTo

The transform used as a reference to transform to.

transformPlane

The transform plane to use.

transformPlaneCustom

The custom transform plane to use (if required).

useScale

If the returned matrix should include scale. Scale is not relative and always uses the transformTo lossyScale.

Returns

Type

Description

Matrix4x4The calculated relative transformation matrix.

GetRelativeMatrix2D(Matrix4x4, Matrix4x4, PhysicsWorld, bool)

Get the relative transformation matrix between the two specified transform matrix using the specified world's transform plane to transform into 2D space.
public static Matrix4x4 GetRelativeMatrix2D(in Matrix4x4 transformFrom, in Matrix4x4 transformTo, PhysicsWorld world, bool useScale = true)

Parameters

transformFrom

The transform used as a reference to transform from.

transformTo

The transform used as a reference to transform to.

The world whose transform plane is used.

useScale

If the returned matrix should include scale. Scale is not relative and always uses the transformTo lossyScale.

Returns

Type

Description

Matrix4x4The calculated relative transformation matrix.