Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ToPosition3D

Transform a 2D position into a 3D position using the selected transform plane. If PhysicsWorld.TransformPlane.Custom is used, PhysicsWorld.TransformPlane.XY will be used instead which may not provide the correct results.
Read time 1 minuteLast updated 11 days ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

ToPosition3D(Vector2, Vector3, TransformPlane)

Transform a 2D position into a 3D position using the selected transform plane. If PhysicsWorld.TransformPlane.Custom is used, PhysicsWorld.TransformPlane.XY will be used instead which may not provide the correct results.
public static Vector3 ToPosition3D(Vector2 position, Vector3 reference, PhysicsWorld.TransformPlane transformPlane = TransformPlane.XY)

Parameters

position

The 2D position to transform.

reference

The 3D position used as a reference.

transformPlane

The transform plane to use.

Returns

Type

Description

Vector3The transformed position.

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

position

The 2D position to transform.

reference

The 3D position used as a reference.

transformPlane

The transform plane to use.

transformPlaneCustom

The custom transform plane (if required).

Returns

Type

Description

Vector3The transformed position.