Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ToPosition2D

Transform a 3D position into a 2D position using the selected transform plane. If TransformPlane.Custom is used then PhysicsWorld.TransformPlane.XY is used.
Read time 1 minuteLast updated 13 days ago

Definition

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

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

position

The 3D position to transform.

transformPlane

The transform plane to use.

Returns

Type

Description

Vector2The transformed position.

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

position

The 3D position to transform.

transformPlane

The transform plane to use.

transformPlaneCustom

The custom transform plane (if required).

Returns

Type

Description

Vector2The transformed position.