How to get the correct intersection coordinates?

Viewed 17

Created two squares. Applied to both BoxCollider2D. I added a RigidBody2D to the red one and turned off the simulation in it so that there was no extrusion. When I press SPACE, I shift the red square by 1 along the X axis. A collision occurs. With the help of OnCollisionEnter2D I read and output to the console the coordinates of the intersection points. There are always two of them. In the picture, I selected them and signed the coordinates (0; 0.7) and (0.5; 1). But if you look at their calculated coordinates in the console, it turns out that they are (0; 0.85) and (0.52; 0.85). If we compare the x-coordinates, then they are approximately equal. But the Y-coordinates of both points = 0.85. And this is just the middle between the Y-coordinates in the picture. Tell me why is this happening? And how to get the correct intersection coordinates?

enter image description here

0 Answers
Related