2D Physics for 3D Game

I think that what I want to do is quite simple: use Unity’s 2D physics on the XZ plane. I’ve been trying for a while now and I haven’t found any ways or resources to do this. Can this be done in Unity? Are there maybe any 3rd party solutions?

This feature seems like something basic for a 3D game engine like Unity with potential for making MOBAs, RTS’s, Tower Defenses, and other games that only need 2D physics in a 3D environment.

For example, in my BRTS game, I would like to implement range detection with a 2D collision system instead of with a 3D collision system because:

  1. More performance friendly
  2. More deterministic (I want to keep floating-point math to a minimum for maximum determinism)
  3. It suits my gameplay. Where a sphere collider would treat units on a higher plane differently than ones on the same plane (I.e. ground-to-air), 2D colliders would not and allow me to properly implement my range system.

A visual explanation:
alt text

I would be okay with flipping my game so that the XY plane is the ground but the problem with that is the editor camera won’t follow suit. I would then have to edit my game rotating on the wrong axis and moving in the wrong directions.

Thank you so much to anyone who helps me solve this issue. This is the last missing piece of my game and I really need a solution.

Do all your physics in the XY plane on 2d “proxy” objects. Then attach a small script to each object that copies the transform values from the proxy object to your rendered object. You can translate the Y to Z during the copy.

You’ll probably want to have the script detect when it’s in edit mode, and have it copy the 3d transform to the proxy object, so you don’t have to manage that separately.

This isn’t really an answer but a potential solution. If you’re like me and you need 2D physics in a 3D environment, please help make this essential feature happen by voting up the suggestion: feedback.unity3d.com/suggestions/extend-2d-physics-to-xz-plane .

Thanks for the support! Hopefully Unity takes notice of the issue and works to solve it so many more game of different genres can be created with better performance and more practicality.

U can use

 private void Update()
        {
            CircleCollider2D.offset =  new Vector3(0,transform.position.z,0);
        }