No 100% accurate physics/collision handling

I am new to Unity and experimenting the last few weeks, trying to create a 2D concept I had in mind. In those experiments I found out that the Physics engine is not 100% accurate, especially in collision handling, creating a few problems in my project. In the following video (only 14 seconds, don’t worry) I have two cubes, one scaled in x-axis acting as floor, and the second one with a rigibody attached waiting to fall on the floor.

1

In order to create the 2D setup I have activated the FreezePositionZ, FreezeRotationX and FreezeRotationY constrains. The problem that I encounter is that the cube doesn’t end up in the position that it should (x=0, y=1, z=0, x-y-z-rotation=0). As you can see in the image below the position-y = 0.98 and rotation-z=0.001 (never mind the position-x for now).

alt text

Image Direct Link

I have found a way to minimize the position-y difference (Edit->Project Settings->Physics->Min Penetration for Penalty = 0), but not to make it be exact 1, as it should. The main problem now is the z-rotation.

I am using the most simple primitive shapes, I find it very strange that the engine doesn’t do a better job in collision handling. Is there any way to get the proper values?

Thanks in advance!

If you want precise positioning, forget about physics. In all game engines, the physics engine is intended to simulate real world physics, which includes some amount of uncertainty: anytime you let the rigidboy fall to the floor, for instance, it will bounce and stop in a slightly different angle - just like in real life.

If you really need precision, remove the rigidbody and handle its positioning, rotation and movement by script - you will have precision, but the object will not detect collisions.
Another alternative is the CharacterController: it’s not under physics control, but detects collisions, and is used mostly in characters.