文档

Unity Engine

Unity Engine

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.
阅读时间1 分钟最后更新于 4 天前

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

position

The 3D position to transform.

transformPlane

The transform plane to use.

transformPlaneCustom

The custom transform plane, used when transformPlane is TransformPlane.Custom.

Returns

Type

Description

Vector2The transformed position.

ToPosition2D(Vector3, TransformPlane)

Transform a 3D position into a 2D position using the selected transform plane.
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, 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

position

The 3D position to transform.

The world whose transform plane is used.

Returns

Type

Description

Vector2The 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

transform

The Transform whose world position is transformed.

The world whose transform plane is used.

Returns

Type

Description

Vector2The transformed position.