ToPosition2D
Transform a 3D position into a 2D position using the selected transform plane. This can also be used for a 3D scale vector as it undergoes the same transformation.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
ToPosition2D(Vector3, TransformPlane, TransformPlaneCustom)
Transform a 3D position into a 2D position using the selected transform plane. This can also be used for a 3D scale vector as it undergoes the same transformation.
public static Vector2 ToPosition2D(Vector3 position, PhysicsWorld.TransformPlane transformPlane, in PhysicsWorld.TransformPlaneCustom transformPlaneCustom)
Parameters
The 3D position to transform.
The transform plane to use.
The custom transform plane (if required).
Returns
Type | Description |
|---|---|
| Vector2 | The transformed position. |
ToPosition2D(Vector3, TransformPlane)
Transform a 3D position into a 2D position using the selected transform plane. If TransformPlane.Custom is used then PhysicsWorld.TransformPlane.XY is used.
public static Vector2 ToPosition2D(Vector3 position, PhysicsWorld.TransformPlane transformPlane = TransformPlane.XY)
Parameters
Returns
Type | Description |
|---|---|
| Vector2 | The transformed position. |
ToPosition2D(Vector3, PhysicsWorld)
Transform a 3D position into a 2D position using the specified world's transform plane.
public static Vector2 ToPosition2D(Vector3 position, PhysicsWorld world)
Parameters
The 3D position to transform.
The world whose transform plane is used.
Returns
Type | Description |
|---|---|
| Vector2 | The transformed position. |
ToPosition2D(Transform, PhysicsWorld)
Transform a Transform's world position into a 2D position using the specified world's transform plane.
public static Vector2 ToPosition2D(Transform transform, PhysicsWorld world)
Parameters
The Transform whose world position is transformed.
The world whose transform plane is used.
Returns
Type | Description |
|---|---|
| Vector2 | The transformed position. |