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

KinematicBody colliding with meshes of a GridMap throws recover_from_penetration errors #40969

Closed
Miziziziz opened this issue Aug 2, 2020 · 3 comments

Comments

@Miziziziz
Copy link

Godot version: 3.2.2.stable

OS/device including version: Windows 10

Issue description:
When a KinematicBody moves through a Gridmap on the same layer, this error is thrown constantly:
recover_from_penetration: Condition "shape_idx < 0 || shape_idx >= cs->getNumChildShapes()" is true. Returned: false
<C++ Source> modules/bullet/space_bullet.cpp:1249 @ recover_from_penetration()
KinematicBody.gd:5 @ _physics_process()

This error shouldn't be thrown, the Gridmap has no colliders or physics on it, it's purely graphical.

Steps to reproduce:
Have a kinematic body use move_and_collide/slide to move through a Gridmap tile.
Example video attached:
ExampleVIdeo.zip

Minimal reproduction project:

Physics Error repro.zip

@madmiraal
Copy link
Contributor

This is not actually a physics problem, because it's correctly identifying that the StaticBody associated with the Mesh item has no CollisionShape. It's a problem with MeshLibraries (and related to #11888 which is about not being able to add shapes to a Mesh in a MeshLibrary). Basically, if the MeshLibrary Item has no shapes, it shouldn't be creating an associated StaticBody.

@laverneth
Copy link

It happened to me without StaticBodies, only "visual tiles". I "solved" the issue by deactivating the collision layers of the purely graphical gridmap

@rburing
Copy link
Member

rburing commented May 3, 2022

The case of a compound collision shape with zero child shapes was being treated as an error in recover_from_penetration, causing an early return from the function, which could cause the recovery from other shapes to be skipped. In fact recovering from a compound collision shape with zero child shapes is very easy: just ignore it. I implemented this in #59864 because the previous early return caused a pretty bad bug (see the issue linked there). Hence, this issue here can be closed as well.

I agree with @madmiraal that it would be better if GridMap somehow would not create static bodies without shapes. This should be discussed in a separate issue.

@akien-mga akien-mga added this to the 3.5 milestone May 3, 2022
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

6 participants