Iterating through the box2d (box2dWeb-2.1.a.3.js) body list

A simple example of how to iterate through the body list. This is a useful feature to know in order to perform operations on all the bodies in box2d.
for (var body = world.GetBodyList(); body; body = body.GetNext())
{

    // do something here with each body, for example apply an impulse, etc.

}

Responses

0 Replies