我用cocos2d精灵创造了2个box2d的身体….他们有不同的质量,他们从世界上的同一个地方坠落.但他们同时倒下了.我的想法是较轻的身体应该落后于较重的身体…..但他们没有. for (int k=1;k=
for (int k=1;k<=2; k++) { int idx = (CCRANDOM_0_1() > .5 ? 0:1); int idy = (CCRANDOM_0_1() > .5 ? 0:1); CCSprite *sprite = [CCSprite spriteWithBatchNode:batch rect:CGRectMake(32 * idx,32 * idy,32,32)]; [batch addChild:sprite]; sprite.position = ccp( p.x+(32*k), p.y); b2BodyDef bodyDef; bodyDef.type = b2_dynamicBody; bodyDef.position.Set(( p.x+(32*k))/PTM_RATIO, p.y/PTM_RATIO); bodyDef.userData = sprite; b2Body *body = world->CreateBody(&bodyDef); b2PolygonShape dynamicBox; dynamicBox.SetAsBox(.5f, .5f);//These are mid points for our 1m box b2FixtureDef fixtureDef; fixtureDef.shape = &dynamicBox; fixtureDef.density = 1.0f/k; fixtureDef.friction = 0.3f; body->CreateFixture(&fixtureDef); NSLog(@"%f",body->GetMass()); }好吧,Galileo Galilei发现所有物体以相同的速度下落……
https://web.archive.org/web/20100728100438/http://galitzin.mines.edu/INTROGP/notes_template.jsp?url=GRAV%2FNOTES%2Ffallb.html&page=Gravity%3A%20Notes%3A%20Falling%20Bodies