Hello!
I have started a Box2D project similar to the testbed example:
Main class, Test class and a TestLevel classes, where TestLevel extends Test and I instantiate new levels by
var Level1:Test = new TestLevel();
Everything works perfectly in debugDraw mode, but when I try to add some UserData and turn off the debug draw, the UserData mc gets stuck in the upper-left corner and nothing happens...
Here is how I try to update de userData mc's position/rotation:
I get the feeling that this is were I do something wrong, as a trace(bb.GetUserData()) returns null...
I use Box2D 2.1a
Thank you for your time and efforts!
GF
I have started a Box2D project similar to the testbed example:
Main class, Test class and a TestLevel classes, where TestLevel extends Test and I instantiate new levels by
var Level1:Test = new TestLevel();
Everything works perfectly in debugDraw mode, but when I try to add some UserData and turn off the debug draw, the UserData mc gets stuck in the upper-left corner and nothing happens...
Here is how I try to update de userData mc's position/rotation:
Code: Select all
// Go through body list and update sprite positions/rotations
for (var bb : b2Body = m_world.GetBodyList();bb;bb = bb.GetNext()) {
if (bb.GetUserData() is MovieClip) {
var sprite : MovieClip = bb.GetUserData() as MovieClip;
sprite.x = bb.GetPosition().x * 30;
sprite.y = bb.GetPosition().y * 30;
sprite.rotation = bb.GetAngle() * (180 / Math.PI);
}
}I get the feeling that this is were I do something wrong, as a trace(bb.GetUserData()) returns null...
I use Box2D 2.1a
Thank you for your time and efforts!
GF