Box2D Forums

It is currently Wed Oct 22, 2014 2:39 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: HelloWorld
PostPosted: Sun Jan 29, 2012 12:21 pm 
Offline

Joined: Tue Feb 24, 2009 4:10 pm
Posts: 564
Location: Michigan
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


Top
 Profile  
 
 Post subject: Re: HelloWorld
PostPosted: Mon Jan 30, 2012 2:05 am 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 258
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.


Top
 Profile  
 
 Post subject: Re: HelloWorld
PostPosted: Mon Jan 30, 2012 7:15 pm 
Offline

Joined: Tue Feb 24, 2009 4:10 pm
Posts: 564
Location: Michigan
many thanks jayther.
for your clear and accurate answer.


Top
 Profile  
 
 Post subject: Re: HelloWorld
PostPosted: Mon Jan 30, 2012 9:57 pm 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 258
No problem. -]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group