How do I create a ball shape? What am I doing wrong?

Discuss issues specific to the Flash/AS3 port of Box2D
Farjuan
Posts: 17
Joined: Thu Mar 07, 2013 4:00 pm

How do I create a ball shape? What am I doing wrong?

Postby Farjuan » Thu Mar 07, 2013 4:06 pm

I am continually getting this error:
1067: Implicit coercion of a value of type Number to an unrelated type Box2D.Collision.Shapes:b2ShapeDef.

when trying to create a circle shape, here is the code:

Code: Select all

 var wheelShape:b2CircleShape = new b2CircleShape(12/RATIO);


I have no idea what i'm doing wrong, every tutorial I look at uses this and it works, how do I get a ball rolling?

jayther
Posts: 266
Joined: Sun Oct 25, 2009 3:28 am
Contact:

Re: How do I create a ball shape? What am I doing wrong?

Postby jayther » Thu Mar 07, 2013 11:08 pm

You're probably using Box2D 2.0.2, where b2CircleShape only takes in a b2ShapeDef. Box2D 2.1a is the one that takes in a radius. Switch to Box2D 2.1a, as that is better in almost every way anyhow. Most tutorials use Box2D 2.1.

If you're stuck with Box2D 2.0.2, refer to the old documentation: http://www.box2dflash.org/docs/2.0.2/reference/

Farjuan
Posts: 17
Joined: Thu Mar 07, 2013 4:00 pm

Re: How do I create a ball shape? What am I doing wrong?

Postby Farjuan » Sat Mar 09, 2013 8:26 pm

jayther wrote:You're probably using Box2D 2.0.2, where b2CircleShape only takes in a b2ShapeDef. Box2D 2.1a is the one that takes in a radius. Switch to Box2D 2.1a, as that is better in almost every way anyhow. Most tutorials use Box2D 2.1.

If you're stuck with Box2D 2.0.2, refer to the old documentation: http://www.box2dflash.org/docs/2.0.2/reference/


yea that was the problem, thank you very much


Return to “Flash”



Who is online

Users browsing this forum: No registered users and 2 guests