Box2D Forums

It is currently Sun May 19, 2013 4:31 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Dec 08, 2010 7:36 am 
Offline

Joined: Thu Nov 11, 2010 8:14 am
Posts: 18
Hi, I create 2 boxes with following code:
Code:
var myShape:PolygonShape= new b2PolygonShape();
var torsoB:b2Body;
myShape.SetAsBox(10/RATIO, 10/RATIO);
         b2Def.fixture.shape = myShape;
         b2Def.fixture.density=1;
         b2Def.fixture.friction = 0.5;
         b2Def.fixture.restitution = 0;
         
         myBodyDef=new b2BodyDef();
         myBodyDef.type = b2Body.b2_dynamicBody;
         myBodyDef.position.v2 = new V2(my.x/RATIO,(my.y-250)/RATIO);
         //myBodyDef.fixedRotation=true;
         //b2Def.body.position.v2 = new V2(roda1.GetPosition().x,roda1.GetPosition().y-15/RATIO);
         torsoB = myWorld.CreateBody(myBodyDef);
         torsoB.CreateFixture(b2Def.fixture);
         
         myShape.SetAsBox(10/RATIO, 10/RATIO);
         b2Def.fixture.shape = myShape;
         b2Def.fixture.density = 0.1;
         b2Def.fixture.friction = 0.5;
         b2Def.fixture.restitution = 0;
         
         myBodyDef=new b2BodyDef();
         myBodyDef.type = b2Body.b2_dynamicBody;
         myBodyDef.position.v2 = new V2((my.x+50)/RATIO,(my.y-250)/RATIO);
         //myBodyDef.fixedRotation=true;
         //b2Def.body.position.v2 = new V2(roda1.GetPosition().x,roda1.GetPosition().y-15/RATIO);
         var torsoBB:b2Body;
         torsoBB = myWorld.CreateBody(myBodyDef);
         torsoBB.CreateFixture(b2Def.fixture);


Though they have same size and different density, they fall to the ground with the same speed, so at the same time. Only force acts onto them is gravity. Why? Shouldn't the one with the more density reach the ground first ?


Top
 Profile  
 
PostPosted: Wed Dec 08, 2010 3:28 pm 
Offline

Joined: Fri Dec 14, 2007 8:07 pm
Posts: 913
That's how gravity works. Heavy objects don't fall faster than light objects.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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