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

PhysicsMath.TryGetRelativeMatrix2D

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 bool TryGetRelativeMatrix2D(ref Matrix4x4 transformFrom, ref Matrix4x4 transformTo, TransformPlane transformPlane, ref TransformPlaneCustom transformPlaneCustom, out Matrix4x4 relative);

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).
relative The calculated relative transformation matrix, or the identity matrix if this returns false.

Returns

bool Whether a valid relative transformation matrix was calculated.

Description

Try to get the relative transformation matrix between the two specified transform matrix using the specified transform plane to transform into 2D space, the same as PhysicsMath.GetRelativeMatrix2D but never returning a NaN result. Each matrix is checked first: if its scale on the plane's ignored axis is at or near zero, such as a matrix built from flattened 2D data, that axis is treated as one instead of leaving the matrix singular. Returns false, instead of a matrix with a NaN rotation, when either matrix has too small an in-plane scale to work with, or the relative transform itself is too close to singular to invert cleanly.