What is the best way of constraining physics on 2 axis?
I want to build a game where I only need 2d physics. Now the physX in unity are all 3D. Is there a function/option somewhere to just have 2D physics aligned on 2 axis. If not what would be the best way of having 2D physics, just attach to giant planes to the sides of the game?
Depends on exactly what you want to do, but I did something along these lines in a project I just completed. For me, enabling the “Freeze rotation” property of the rigidbody objects was enough to prevent them “spinning” on their Y axis which is all that was ruining my “illusion of 2D”. They still happily bounced off of each other which is all I needed.
I also added cubes (very flat plane-ish cubes) to the sides of the play area to confine the objects in space.