This forum is read only and just serves as an archive. If you have any questions, please post them on

1 decade ago by agmcleod

Seeing a fair number of examples on here of using things like b2.Vec, and b2.ContactListener. However, in my box2dgame, when i try to access b2, it's undefined. Is there something specific I need to do to set it up properly?

You can see my main.js here:

Gravity and such is working as expected, as well as the ApplyForce in the truck entity.

1 decade ago by Neeko

The many examples floating around this site are outdated. I believe b2 was referring to the global Box2D object, but has since changed. Using the latest plugin, you should use Box2D.

Example this

var bodyDef = new b2.BodyDef();


var bodyDef = new Box2D.Dynamics.b2BodyDef();

Review for further info on the classes and how to call them.

1 decade ago by agmcleod

Ah gotcha. I was kinda wondering that, knowing that


is now on


I believe. I was thinking maybe there was another module I missed. That said, any idea where CollisionListener is located?

1 decade ago by agmcleod

Nevermind, found it at: Box2D.Dynamics.b2ContactListener, not sure how I missed that last night, swore I checked through all the namespaces. Thanks :)
Page 1 of 1
« first « previous next › last »