Search Issue Tracker

By Design

Votes

0

Found in

2018.4

2019.4

2020.2

2020.2.2f1

2021.1

2021.2

Issue ID

1311101

Regression

No

Rigidbody2D.Distance is returning incorrect results when used between a Capsule Collider 2D and a rotated Box Collider 2D

Physics2D

-

How to reproduce:
1. Open the attached project (case_1311101-DistanceTest)
2. Open the DistanceTest Scene
3. Move the Collision Game Object around to see the expected behavior
4. Move the Collision Game Object to the (0, 0) position

Expected result: You can see the correct separation of the colliders
Actual result: The separation of the colliders is not visible

Reproducible with: 2018.4.30f1, 2019.4.19f1, 2020.2.5f1, 2021.1.0b7, 2021.2.0a4

  1. Resolution Note:

    The basic solver that the script is performing does not take tiny floating-point errors into account. It produces a tiny overlap of "-0.0000000596046448" (effectively 59 nanometers) and it's negative. The script then continues to try to solve that but it just can't because it's way below the precision here.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.