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

PhysicsMath.TryGetPlaneMatrix2D

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 TryGetPlaneMatrix2D(Matrix4x4 matrix, TransformPlane transformPlane, out Matrix4x4 planeMatrix);

Parameters

Parameter Description
matrix The matrix to build from.
transformPlane The transform plane to use.
planeMatrix The resulting matrix, or the default matrix if this returns false.

Returns

bool Whether a valid matrix was calculated. Returns false when the matrix has an in-plane axis too small to build from.

Description

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.

A matrix whose out-of-plane axis is at or near zero length, such as one built from flattened 2D data, has that axis replaced by the plane normal; left as zero it makes the whole matrix singular, and inverting it later would produce a NaN result. The in-plane axes are never touched, so a mirror or a scale on the plane is kept exactly as it is.