Physic to 2D

How are you,

I’m doing a 2d project, and using dots and ecs, but got to the point of collisiones, and found physics, but this works for 3d, and the physics2d project is linked to tiny project. My question is if someone adapted physic to work in a 2d environment. Since I tried to use a shape box, but without depth (Z=0). (Work only with X Y coordinates), but when using a dynamic body it does not collide with other objects that have Z=0. But if I place an object with Z <> 0, I do find a collision. Would I have to freeze any axis? or any idea how to emulate collisions in 2d.

Thanks in advance.

A short hack would be to freeze the tensors of inertia to zero in the X, Y-axis (or whatever plane you choose to work on) and add a system to reset the one locked linear axis in the Translation component to zero.

Also, you can use the old Physics Components such as RigidBody(3d) and BoxCollider(3d) and freeze the axis you want to make your game behave as if it was a 2D game. Remember: you will have to add them into a SubScene or toggle the button “Convert to Entity” to benefit the UnityPhysics engine.

Thank you for your answer, I will put into practice what you indicate. regards