reactphysics3d icon indicating copy to clipboard operation
reactphysics3d copied to clipboard

Random assert "Assertion failed: mNodes[nodeID].aabb.contains(newAABB)"

Open caxapexac opened this issue 3 years ago • 4 comments

This happens sometimes, just by random after ~5-50secs of running code that doesn't use anything except static rigidbodies and collisionbodies. Just character controller that uses collide to find extrusion vector and some static geometry. The more rigidbodies I have the more probability of crash (it crashed after about 5 secs after adding ~30 rigidbodies)

What should I try to check to locate the root of the problem. I mean, this assert fails on broad phase but I don't touch broad phase manually, I only call world.update() then interpolate transforms almost as written in docs...

caxapexac avatar May 09 '22 04:05 caxapexac

Thanks for reporting this. Where is this line exactly in the code? Can I ask you to post here the values of the AABB coordinates for the two variables 'aabb' and 'newAABB' when the assert occurs?

DanielChappuis avatar May 09 '22 05:05 DanielChappuis

Sorry for the late reply, I'm trying to reproduce the issue, wait for the several days please

caxapexac avatar May 14 '22 07:05 caxapexac

@DanielChappuis I also had the same assertion failure under slightly different conditions (steps):

  1. RigidBody centered inside CollisionBody (both with colliders)
  2. Change RigidBody type to dynamic
  3. Call world update
  4. A custom EventListener::onContact callback applies force to the RigidBody
  5. Assertion failure at DynamicAABBTree.cpp:209

Only after following your comment, I found out that one of the aabb's contained NaN values. These came from step 4: the applied force vector was also NaN (incorrect calculation on my side).

I suggest to introduce something like assert(force.isFinite()) in RigidBody::applyWorldForceAt[Local/World]Position. In case the assertion won't break anything, it would save the debugging time. Even in my simple setup it took me too long to find the culprit.

Casqade avatar Oct 28 '22 12:10 Casqade

Yes that's a good idea. Thanks a lot for your feedback.

DanielChappuis avatar Oct 28 '22 13:10 DanielChappuis