-
Hello! I've run into a scenario where Bepu is reporting a collision (i.e. triggering a narrow phase callback with a manifold with contacts with positive depth), but the depth on each contact is larger than should be possible. Specifically, an upright, kinematic cylinder (representing a video game character) is having a collision reported against a vertical triangle within a mesh, i.e. a triangle with a unit-Z normal. From a top-down perspective, the scenario looks like this: https://imgur.com/a/QQnhopl (I've included the triangle's normal in this image, although it may not be relevant to my question here). As shown, a manifold with positive depth is generated by Bepu despite the cylinder not touching the triangle. In other words, the reported depth is (significantly) greater than the cylinder's radius. In this specific instance, I can work around the problem by manually comparing contact depth vs. cylinder radius, but it's still concerning to me that my game might respond to other "phantom" collisions. Feels like an edge case (potentially resulting in a game crash) waiting to happen. Hoping for some clarity on whether this scenario is considered "valid" and, if so, how I might identify (and skip processing on) such collisions in the general case. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It definitely doesn't sound valid! Is this on latest master? Could you provide a minimal reproduction in the demos? |
Beta Was this translation helpful? Give feedback.
-
Welp, false alarm. Turns out it's a problem with my game logic, not Bepu. I'm using an To summarize, Bepu is reporting collisions accurately, but my game logic erroneously pulled the wrong triangle. I apologize for not verifying more thoroughly before posting. Ross, would you prefer I delete this post, or leave it up and mark my own answer as the "solution"? |
Beta Was this translation helpful? Give feedback.
Welp, false alarm. Turns out it's a problem with my game logic, not Bepu.
I'm using an
INarrowPhaseCallbacks
implementation that allows objects to track specific collisions (using a function with the signatureOnContact(CollidableReference collidable, int childIndex)
). The mistake I made is thatINarrowPhaseCallbacks
has two overloads each forAllowContactGeneration
andConfigureContactManifold
, one that takes child indexes and one that doesn't. For a body with multiple collidables (like aMesh
), both functions are called while processing collisions, not just the child version. My mistake, then, was callingOnContact(collidable, 0)
(note the hardcoded0
) for the non-child overload. By a h…