ToPosition3D
Transform a 2D position into a 3D position using the selected transform plane.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
ToPosition3D(Vector2, Vector3, TransformPlane, TransformPlaneCustom)
Transform a 2D position into a 3D position using the selected transform plane.
public static Vector3 ToPosition3D(Vector2 position, Vector3 reference, PhysicsWorld.TransformPlane transformPlane, in PhysicsWorld.TransformPlaneCustom transformPlaneCustom)
Parameters
The 2D position to transform.
The 3D position used as a reference.
The transform plane to use.
The custom transform plane (if required).
Returns
Type | Description |
|---|---|
| Vector3 | The transformed position. |
ToPosition3D(Vector2, Vector3, TransformPlane)
Transform a 2D position into a 3D position using the selected transform plane.
public static Vector3 ToPosition3D(Vector2 position, Vector3 reference, PhysicsWorld.TransformPlane transformPlane = TransformPlane.XY)
Parameters
The 2D position to transform.
The 3D position used as a reference.
The transform plane to use.
Returns
Type | Description |
|---|---|
| Vector3 | The transformed position. |
ToPosition3D(Vector2, Vector3, PhysicsWorld)
Transform a 2D position into a 3D position using the specified world's transform plane.
public static Vector3 ToPosition3D(Vector2 position, Vector3 reference, PhysicsWorld world)
Parameters
The 2D position to transform.
The 3D position used as a reference.
The world whose transform plane is used.
Returns
Type | Description |
|---|---|
| Vector3 | The transformed position. |
ToPosition3D(Vector2, Transform, PhysicsWorld)
Transform a 2D position into a 3D position using the specified world's transform plane, taking the out-of-plane depth from a Transform.
public static Vector3 ToPosition3D(Vector2 position, Transform reference, PhysicsWorld world)
Parameters
The 2D position to transform.
The Transform whose world position is used as a reference.
The world whose transform plane is used.
Returns
Type | Description |
|---|---|
| Vector3 | The transformed position. |