我有一些盒子,使用box2d创建,其恢复设置为零。但是当它们相互摔倒时会出现反弹事件。但我不希望那样......我希望它们在摔倒另一个时不会移动。它可以如果我关闭重力就可以完成。但我也想要重力。这是我的代码
UIImage *imageOfSnowV1 = [ UIImage imageNamed:[NSString stringWithFormat:@"Object%d.png",currentlySelected]];
CCTexture2D *texOfSnowV1 = [[ [CCTexture2D alloc] initWithImage:imageOfSnowV1 ] autorelease];
CCSprite *sprite = [CCSprite spriteWithTexture:texOfSnowV1 rect:CGRectMake(0, 0, 32, 32)];
[self addChild:sprite];
sprite.position = ccp(p.x, p.y);
sprite.tag=[temp intValue];
// Define the dynamic body.
//Set up a 1m squared box in the physics world
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(p.x/PTM_RATIO, p.y/PTM_RATIO);
bodyDef.userData = sprite;
b2Body *bodyS = world->CreateBody(&bodyDef);
// Define another box shape for our dynamic body.
b2PolygonShape dynamicBox;
dynamicBox.SetAsBox(.5f, .5f);//These are mid points for our 1m box
b2MassData massData;
massData.mass = 0.1f;
bodyS->SetMassData(&massData);
// Define the dynamic body fixture.
b2FixtureDef fixtureDef;
fixtureDef.shape = &dynamicBox;
fixtureDef.density = 50.0f;
fixtureDef.restitution=0.0f;
fixtureDef.friction = 0.01f;
bodyS->CreateFixture(&fixtureDef);
谁能帮我?