Hi
I have two circles, that can be dragged with a mouse joint.
The problem is that when a ball start touching another ball, then it become sticky, and ir hard to separate them. Here is a video (sorry for the aspect ratio) http://www.youtube.com/watch?v=-z-ZnHGNUCg
I googled for sticky bodies in box2d and found that b2_velocityThreshold=0 could solve my problem. I've tried it but it didn't worked for me.
Have somebody any related info?
The gravity is 0 and here is how the ball are created:
Thank you very much!
I have two circles, that can be dragged with a mouse joint.
The problem is that when a ball start touching another ball, then it become sticky, and ir hard to separate them. Here is a video (sorry for the aspect ratio) http://www.youtube.com/watch?v=-z-ZnHGNUCg
I googled for sticky bodies in box2d and found that b2_velocityThreshold=0 could solve my problem. I've tried it but it didn't worked for me.
Have somebody any related info?
The gravity is 0 and here is how the ball are created:
Code:
for (LSBall *ball in level.balls) {
b2BodyDef ballBodyDef;
ballBodyDef.type = b2_staticBody;
ballBodyDef.position.Set(ball.center.x / PTM_RATIO, (ball.center.y) / PTM_RATIO);
ballBodyDef.userData = ball;
ballBodyDef.fixedRotation = true;
ballBodyDef.bullet = true;
ballBodyDef.userData = ball;
b2Body *ballBody = world->CreateBody(&ballBodyDef);
b2CircleShape ballShape;
ballShape.m_radius = ball.radius / PTM_RATIO;
b2FixtureDef ballShapeDef;
ballShapeDef.shape = &ballShape;
ballShapeDef.density = 1.0f;
ballShapeDef.friction = 0.0;
ballShapeDef.restitution = 0.0;
ballBody->CreateFixture(&ballShapeDef);
LSPhysicsData *physicsData = [[LSPhysicsData alloc] init];
physicsData.body = ballBody;
ball.physicsData = physicsData;
[physicsData release];
b2BodyDef ballBodyDef;
ballBodyDef.type = b2_staticBody;
ballBodyDef.position.Set(ball.center.x / PTM_RATIO, (ball.center.y) / PTM_RATIO);
ballBodyDef.userData = ball;
ballBodyDef.fixedRotation = true;
ballBodyDef.bullet = true;
ballBodyDef.userData = ball;
b2Body *ballBody = world->CreateBody(&ballBodyDef);
b2CircleShape ballShape;
ballShape.m_radius = ball.radius / PTM_RATIO;
b2FixtureDef ballShapeDef;
ballShapeDef.shape = &ballShape;
ballShapeDef.density = 1.0f;
ballShapeDef.friction = 0.0;
ballShapeDef.restitution = 0.0;
ballBody->CreateFixture(&ballShapeDef);
LSPhysicsData *physicsData = [[LSPhysicsData alloc] init];
physicsData.body = ballBody;
ball.physicsData = physicsData;
[physicsData release];
Thank you very much!