Big Changes - Read Before Updating

News about Box2D
Erin Catto
Site Admin
Posts: 2948
Joined: Thu Sep 06, 2007 12:34 am

Re: Big Changes - Read Before Updating

Postby Erin Catto » Sun Jul 12, 2009 12:42 am

Yeah, you get the shape type off the fixture and cast the shape as needed.

The polygon radius is the skin radius. This means that polygons are held apart according to the radius. This allows me to do continuous physics without a secondary shrunken polygon.

dc443
Posts: 341
Joined: Fri May 16, 2008 10:09 am

Re: Big Changes - Read Before Updating

Postby dc443 » Sun Jul 12, 2009 1:13 am

I understand the concept of a "skin" of a certain thickness being wrapped around a polygon (with a thickness that i guess is what radius represents) but could you tell me a bit more about what things are now changed due to this? Before, if I create a 1x1 box it would create a core shape which is a (1-2*b2_toislop)x(1-2*b2_toislop) box. If I create a 1x1 box now, is it just basically equivalent to having a rounded out (1+2*b2_toislop)x(1+2*b2_toislop) box with the 1x1 unshrunken box geometry now treated as the core shape?

is the b2_toislop constant still there and being used in that way?

With the core shapes there were certain limitations (and assertions being tripped) with shapes that are too slender or too small, i'm guessing because you couldnt fit a core shape within them. I guess those issues are now gone?

Erin Catto
Site Admin
Posts: 2948
Joined: Thu Sep 06, 2007 12:34 am

Re: Big Changes - Read Before Updating

Postby Erin Catto » Mon Jul 13, 2009 1:48 pm

dc443 wrote:I understand the concept of a "skin" of a certain thickness being wrapped around a polygon (with a thickness that i guess is what radius represents) but could you tell me a bit more about what things are now changed due to this? Before, if I create a 1x1 box it would create a core shape which is a (1-2*b2_toislop)x(1-2*b2_toislop) box. If I create a 1x1 box now, is it just basically equivalent to having a rounded out (1+2*b2_toislop)x(1+2*b2_toislop) box with the 1x1 unshrunken box geometry now treated as the core shape?


This is correct.

dc443 wrote:is the b2_toislop constant still there and being used in that way?


This is no longer used.

dc443 wrote:With the core shapes there were certain limitations (and assertions being tripped) with shapes that are too slender or too small, i'm guessing because you couldnt fit a core shape within them. I guess those issues are now gone?


This was one of the main reasons for using polygon skins. This also solves some problems with edge shapes. Going forward, edge shapes will just be polygons with two vertices.

dc443
Posts: 341
Joined: Fri May 16, 2008 10:09 am

Re: Big Changes - Read Before Updating

Postby dc443 » Mon Jul 13, 2009 2:05 pm

Your responses are so concise it is mind-boggling. Thanks for everything, Erin!

mayobutter
Posts: 915
Joined: Fri Dec 14, 2007 8:07 pm
Contact:

Re: Big Changes - Read Before Updating

Postby mayobutter » Thu Jul 16, 2009 4:39 pm

Shapes can now be created without bodies and can be used in low level collision routines, indepedent of the physics system.


Can someone give an example of this? I'm working on an AS Alchemy port and am wondering whether it's worth it / makes sense to have b2Shape/b2Fixture distinction in AS.

skrekkur
Posts: 10
Joined: Thu Oct 29, 2009 7:58 am

Re: Big Changes - Read Before Updating

Postby skrekkur » Tue Nov 24, 2009 7:35 am

Hi Im trying to branch my project to a newer version of box2d than I am currently using. Part of the changes are the fixtures.
Im starting to get the hang of them but I can't find anywhere a direct replacement of the b2ChainEdgeDef which I am using heavily for collision boundaries in my game, both as pure sensors and collidable terrain.
Is there some direct replacement I am missing, or do I have to manually create multiple 2 vertex edges?

Sincere regards,
Ævar Örn Kvaran

Edit: Found a way to to this, b2Loop2 is a b2Vec array filled in with vertices from my level editor.

Code: Select all

   b2BodyDef bd;   
   b2Body* ground = world->CreateBody(&bd);
   ground->SetUserData(userData);
   
   b2PolygonShape shape;
   b2FixtureDef fd;
   fd.shape = &shape;
   fd.isSensor = isSensor;
   
   for (int32 i = 0; i < (vertexCount-1); i++)
   {
      shape.SetAsEdge(b2Loop2[i], b2Loop2[i+1]);
      ground->CreateFixture(&fd);
   }


Return to “News”



Who is online

Users browsing this forum: No registered users and 1 guest