Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

PhysicsMath.GetRelativeMatrix2D

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static Matrix4x4 GetRelativeMatrix2D(ref Matrix4x4 transformFrom, ref Matrix4x4 transformTo, TransformPlane transformPlane, ref TransformPlaneCustom transformPlaneCustom);

Parameters

Parameter Description
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).

Returns

Matrix4x4 The calculated relative transformation matrix. Its in-plane axes are those of transformTo projected onto the plane, so its scale is not relative.

Description

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. The transform to transform from is reduced to its position on the plane and its rotation about the plane normal, the two values a physics body is built from, so its scale and any rotation off the plane do not affect the result. The transform to transform to is placed as it is seen on the plane, so geometry placed with the result lands where a renderer on that transform draws it.


Declaration

public static Matrix4x4 GetRelativeMatrix2D(ref Matrix4x4 transformFrom, ref Matrix4x4 transformTo, PhysicsWorld world);

Parameters

Parameter Description
transformFrom The transform used as a reference to transform from.
transformTo The transform used as a reference to transform to.
world The world whose transform plane is used.

Returns

Matrix4x4 The calculated relative transformation matrix. Its scale is not relative and always uses the in-plane scale of transformTo.

Description

Get the relative transformation matrix between the two specified transform matrix using the specified world's transform plane to transform into 2D space.