Version: Unity 6.7 Beta (6000.7)
Language : English
Detect contact between 2D Physics Core objects
Optimize 2D Physics Core with multithreading

Run 2D physics in 3D space with 2D Physics Core

Create a 2D physics world at any angle in 3D space, instead of the traditional x, y plane that faces the camera. This allows you to use 2D physics in a 3D game.

Note: This documentation is about using Pose, Area, and Constraint components. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to 2D physics instead.

To run 2D physics in 3D space, follow these steps:

  1. Create a physics world.
  2. In the Inspector window of the Physics Simulation Definition asset, set Transform Plane to XZ, ZY, or Custom.

The options are:

  • XY means the x-axis remains horizontal and the y-axis remains vertical, so that the world faces the camera in 3D space. This is the default.
  • XZ means the x-axis remains horizontal but the y-axis becomes depth, so that the world lies flat in 3D space.
  • ZY means the x-axis becomes depth but the y-axis remains vertical, so that the world stands upright in 3D space.
  • Custom means Unity uses the plane you define.

The physics system continues to use 2D Vector2 coordinates and vectors, but Unity converts the final positions to 3D space.

To convert coordinates manually between 2D Vector2 and 3D Vector3 types, use the helper methods in the PhysicsMath API.

Additional resources

Detect contact between 2D Physics Core objects
Optimize 2D Physics Core with multithreading