0

I have created a list of the bodies and fixtures, everything works fine, but cannot delete objects by some reason, here is my code ("id" is the id of the div that is linked to a body and fixture, that info is being holding in the body and fixture data): HEEEELLPPPPP!!!

    var bodyItem;
    for(var j=0; j < bodieList.length; j++){
      if (bodieList[j].userData.id == id) bodyItem = bodieList[j];
    };
    //world.DestroyBody (bodyItem);

    var fixItem;
    for(var i=0; i < fixtureList.length; i++){
      //console.log (fixtureList[i].userData.id);
      if (fixtureList[i].userData.id == id) fixItem = fixtureList[i];
    };

    bodyItem.DestroyFixture(fixItem);
    world.DestroyBody(bodyItem);
  • Error messages would help? Why do yo remove the fixture? It is removed by DestroyBody(). You should have a map from id to body to eliminate the need for the loop. – Tobias Ritzau Mar 08 '13 at 14:24
  • 1
    May be this will help: http://stackoverflow.com/questions/14308991/how-do-i-remove-a-body-in-box2dweb-after-a-collision – Shekhar Apr 18 '13 at 10:21

0 Answers0