I made a new 2D Project in unity 2019.2.19f1 and I made two 2D Sprites. I added two both of them box collision and on the one a rigidbody. The settings are the default but there is a distance between those two in play mode. Screenshot by Lightshot Screenshot by Lightshot Screenshot by Lightshot Why is this happening and how can i fix it?
This comes from the underlying 2D physics engine Box2D. It’s a small region (0.01 or 1cm) used to ensure polygons have enough of a buffer for continuous collision-detection to work correctly. It can be changed in “Project Settings > Physics 2D > Default Contact Offset” but doing so for visuals means you can cause other issues so only do so if you know what you’re doing.
It’s supposed to be visually insignificant and you can always make the collider smaller or sprite bigger.
Here’s the setting in Box2D where it’s know as b2_polygonRadius.