Hi,
i don't understand why my character bounces against the ground : when the character touches the ground, the trunk goes a bit down "inside" the legs, and then takes its position a bit above. Would anyone know how to fix it?
I set the "restitution" to 0 for each body part, and i added lowerTranslation/upperTranslation to 0 (otherwise the trunk goes through the legs) :
Code:
/*
*
* LEGS
*
**/
legs = [CCSprite spriteWithSpriteFrameName:@"legs.png"];
legsBody = [self createLegsAtLocation:
body->GetWorldPoint(b2Vec2(0.0/PTM_RATIO, -70.0/PTM_RATIO))
withSprite:legs];
b2Transform axisTransform;
axisTransform.Set(b2Vec2(0, 0), body->GetAngle());
b2Vec2 axis = b2Mul(axisTransform.R, b2Vec2(0,1));
b2PrismaticJointDef prisJointDef;
prisJointDef.Initialize(body, legsBody,
legsBody->GetWorldPoint(b2Vec2(0.0/PTM_RATIO, -70.0/PTM_RATIO)), axis);
prisJointDef.enableLimit = true;
prisJointDef.lowerTranslation = 0.0/PTM_RATIO;
prisJointDef.upperTranslation = 0.0/PTM_RATIO;
world->CreateJoint(&prisJointDef);
I've tried to show this with those images : the first one show the size of the trunk and the legs, and the second one shows that the trunk goes through the legs :
Attachment:
Capture d’écran 2012-06-21 à 22.00.58.png [ 27.76 KiB | Viewed 284 times ]
Attachment:
Capture d’écran 2012-06-21 à 22.00.34.png [ 30.52 KiB | Viewed 284 times ]
Also, the legs go through the trunk in this example, is there a way to fix this?
Attachment:
Capture d’écran 2012-06-21 à 21.47.31.png [ 70.9 KiB | Viewed 285 times ]
Thanks a lot for your help