Hamada Samir
Hamada Samir

Reputation: 61

Nape bodyList ignores bodies

I have 13 bodies on the nape space (5 static and 8 dynamic), when i loop through bodylist to remove dynamic bodies, the loop reads only 9 bodies(5 static and 4 dynamic)and ignores the 4 other dynamic however the bodylist length gives me 13 when tracing it anyone has any idea what is the problem might be? I create the body with click

var body:Body = new Body(BodyType.DYNAMIC);

and when removing

var bList:BodyList = space.bodies;
for(var i:int = 0; i< bList.length; i++)
{
   var bod:Body = bList.at(i);
   if(bod.type == BodyType.DYNAMIC)
   {
       bod.space = null;
   }

}

Upvotes: 0

Views: 52

Answers (0)

Related Questions