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

PhysicsMath.GetRelativeMatrix

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 GetRelativeMatrix(Transform transformFrom, Transform transformTo, TransformPlane transformPlane, bool useScale);

Parameters

Parameter Description
transformFrom The transform used as a reference to transform from. Only its position and rotation are used, the two values a physics body is built from, so its scale and any mirror above it do not affect the result.
transformTo The transform used as a reference to transform to.
transformPlane The transform plane to use.
useScale If the returned matrix should include the scale of transformTo itself. When false, only its own local scale is removed; scale from its parents is kept.

Returns

Matrix4x4 The calculated relative transformation matrix, the same as PhysicsMath.GetRelativeMatrix2D gives for a matrix built from transformFrom's position and rotation and transformTo's local-to-world matrix.

Description

Get the relative transformation matrix between the two specified transforms using the specified transform plane.

For a custom transform plane use PhysicsMath.GetRelativeMatrix2D with each transform's local-to-world matrix instead.