Error removing Body from World

Topics: User Forum
Aug 20, 2010 at 1:55 PM
Edited Aug 20, 2010 at 1:56 PM

Sometimes over the course of my game, I get an blank Assertion Failed error at line 276 (that's the RemoveBody method) of World.cs. Here's what it looks like around that line:


            // You tried to remove a shape that is not attached to this body.


I'm not exactly sure what that might mean. If I ignore the assertion, it throws an exception here (same method, towards the end):


// Delete the attached fixtures. This destroys broad-phase proxies.

            foreach (Fixture fixture in body.FixtureList)

The exception occurs because body.FixtureList is null.


The error occurs rather randomly, as far as I can tell, so I'll be sniffing around for anything that looks like it might be causing it. What kind of mistakes in my code should I be looking out for? Could this be happening because a single Body is being removed twice?

Aug 20, 2010 at 2:07 PM

This happens when you remove a body from the World that already have been removed. I'll change the text to reflect that.