Box2D question

Please don't post Bullet support questions here, use the above forums instead.
samy
Posts: 8
Joined: Wed Nov 29, 2006 12:36 am

Box2D question

Post by samy »

I've been playing around with Erin Catto's Box2D code to see if I can adapt it for use in a platform beat-em-up I'm working on. I added support for circles and ellipses and everything is going very smoothly so far. However, I've run into problems with friction.
Imagine a long flat box representing the ground and a sphere representing the player. If the player runs along the ground and jumps, when he lands (the sphere collides with the box) he gets stuck for a second because of friction. I believe this is happening because of the accumulated normal impulse.
Any tips on what I could alter to prevent this from happening?
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine

Post by Erin Catto »

Usually game characters have zero friction. If you would like to slow down your character, use some damping:

v *= damping_factor

where damping_factor is in [0,1].
Last edited by Erin Catto on Sun Feb 18, 2007 5:15 pm, edited 1 time in total.
samy
Posts: 8
Joined: Wed Nov 29, 2006 12:36 am

Post by samy »

Thanks for the reply. I have another question. I want to implement a simple distance constraint in the same style as the Box2D code. This constraint should prevent the distance between 2 rigid bodies from exceeding some chosen value. I don't want the constraint to effect the angular velocity of the bodies. Could someone give me a quick description of how to implement this using impulses?
TomaszZ
Posts: 4
Joined: Sat Jan 13, 2007 2:03 pm

Post by TomaszZ »

Which problem it is:
1) Two fixed points distance is (==A, <=A, >=A );
2) Center of masses distance is (==A, <=A, >=A ) - special case of 1
3) "dynamic" situation - each frame find clesest points and make their distance (==A, <=A, >=A )
?
samy
Posts: 8
Joined: Wed Nov 29, 2006 12:36 am

Post by samy »

Center of Masses distance should be less than or equal to some specified distance.