GetRelativeMatrix(Transform, Transform, TransformPlane, bool)
Get the relative transformation matrix between the two specified transforms using the specified transform plane.
阅读时间1 分钟最后更新于 4 天前
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public static Matrix4x4 GetRelativeMatrix(Transform transformFrom, Transform transformTo, PhysicsWorld.TransformPlane transformPlane = TransformPlane.XY, bool useScale = true)
Parameters
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.
The transform used as a reference to transform to.
The transform plane to use.
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
Type | Description |
|---|---|
| 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. |
Remarks
For a custom transform plane use PhysicsMath.GetRelativeMatrix2D with each transform's local-to-world matrix instead.