Impact

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

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: https://github.com/agmcleod/ultimate-roadie/blob/4072212b5b932811aaa74a8a95a8bd8628954211/lib/game/main.js

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();

becomes

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

Review http://www.box2dflash.org/docs/2.1a/reference/ 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

b2Vec2

is now on

Box2D.Common.Math

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 »