HelloWorld

HelloWorld.fla should run w/o modification, is there currently a bug in the code?

currently i get the following error.
Location: ...Source\Box2D\Dynamics\b2World.as, Line 871
Description: 1046: Type was not found or was not a compile-time constant: b2Fixture.

line 871 is:
public function RayCastAll(point1:b2Vec2, point2:b2Vec2):Vector.<b2Fixture>

however when i get past this error i see the floor, boxes and circles, and nothing is moving.
I've checked that update is being called.

it's been a little while since I've used a non WCK version of Box2d... i'm afraid I'm a little rusty.
just trying to get HelloWorld.fla working.

edit: it's worth noting which version i am using.
using the latest version from:
http://sourceforge.net/projects/box2dflash/files/box2dflash/Box2DFlashAS3_2.1a/Box2DFlashAS3%202.1a.zip/download
I've never actually run HelloWorld.fla before; I've only ever run PhysTest.fla, since that's what the read me says to run.

Upon running HelloWorld.fla, I got the same "Type was not found..." error, and this was because the .fla is set to run in Flash Player 9. There's no Vector class before Flash Player 10 (and the line it gave an error is a function that returns a Vector of b2Fixtures), so the problem was in the publish settings that went with the .fla file (in case you didn't already know, because you got past that error). This problem is also in PhysTest.fla. There's a Box2D AS3 for Flash Player 9 in case you wanted to work with Arrays rather than Vectors.

But the bug in the code causing the simulation to show a bunch of frozen circles and boxes is the lack of assigning bodyDef.type (the body type (static, kinematic, or dynamic)) with b2Body.b2_dynamicBody in the "for" loop to create the test circles and boxes. The default value in b2BodyDef.type is b2_staticBody, so the HelloWorld simulation actually shows a bunch of static bodies. Adding a line to set bodyDef.type to dynamic would solve this problem and have a working simulation.
many thanks jayther.
for your clear and accurate answer.
No problem. -]
bodyDef.type = 2;

will make it dynamic, by the way...
Very nice, it makes me understand more.
ผลบอลมีเสียงเตือน
i like it

Original thread: https://box2d.org/forum/viewtopic.php?t=8123