Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RigidBody2D sometimes reports incorrect collision normal #43014

Open
Tracked by #45334
madmiraal opened this issue Oct 22, 2020 · 0 comments
Open
Tracked by #45334

RigidBody2D sometimes reports incorrect collision normal #43014

madmiraal opened this issue Oct 22, 2020 · 0 comments

Comments

@madmiraal
Copy link
Contributor

Godot version: 3.2.3.stable

OS/device including version: Ubuntu 20.04

Issue description:
Under certain circumstances, when colliding near the corner of a StaticBody2D, a RigidBody2D will report a collision, but the collision normal will be wrong. Furthermore, the RigidBody2D won't act as if it has collided with the StaticBody2D.

Steps to reproduce:
Send a high-speed RigidBody2D, with Contact Monitoring on, towards the corner of a StaticBody2D, watch it report a collision, report an incorrect collision normal, and act as if it hasn't collided.

It appears as if the collision solver provides the normal of the closest surface as the collision normal. However, when glancing a corner, the penetration may mean the object is closer to the opposite surface than the collision surface. The higher the speed, the greater the chance of an incorrect collision normal.

In the MRP provided, the speed is 500 pixels per second or 8.33 pixels per iteration. When glancing the corner at 45°, an overlap of up to seven pixels on each side of the 30 pixel thick platform are not even treated as a collision. This is normal for high-speed no CCD collision detection. However, a further 7 pixels on each side of the 30 pixel thick platform are detected as a collision, report the wrong normal and don't cause a collision response.

However, this is not just a high-speed problem, even at a mere 100 pixels per second i.e. 1.67 pixels a second, 1 pixel on each side of the 30 pixel thick platform is not detected as a collision, and 1 pixel reports the incorrect normal.

Minimal reproduction project:
RigidBodyCollisionNormal.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant