GetRelativeMatrix2D
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.
読み終わるまでの所要時間 2 分最終更新 3日前
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
GetRelativeMatrix2D(Matrix4x4, Matrix4x4, TransformPlane, TransformPlaneCustom)
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.
public static Matrix4x4 GetRelativeMatrix2D(in Matrix4x4 transformFrom, in Matrix4x4 transformTo, PhysicsWorld.TransformPlane transformPlane, in PhysicsWorld.TransformPlaneCustom transformPlaneCustom)
Parameters
The transform used as a reference to transform from.
The transform used as a reference to transform to.
The transform plane to use.
The custom transform plane to use (if required).
Returns
Type | Description |
|---|---|
| Matrix4x4 | The calculated relative transformation matrix. Its in-plane axes are those of transformTo projected onto the plane, so its scale is not relative. |
GetRelativeMatrix2D(Matrix4x4, Matrix4x4, PhysicsWorld)
Get the relative transformation matrix between the two specified transform matrix using the specified world's transform plane to transform into 2D space.
public static Matrix4x4 GetRelativeMatrix2D(in Matrix4x4 transformFrom, in Matrix4x4 transformTo, PhysicsWorld world)
Parameters
The transform used as a reference to transform from.
The transform used as a reference to transform to.
The world whose transform plane is used.
Returns
Type | Description |
|---|---|
| Matrix4x4 | The calculated relative transformation matrix. Its scale is not relative and always uses the in-plane scale of transformTo. |