Objects sliding horizontally (as if there is no friction)

Hi
I have a basic "floor" shape and body which are totally horizontal and flat.
Balls are bouncing from the top of the screen towards the floor with no elasticity and fricition value of 1. the floor segment is also assigned a value of 1.
instead of losing speed upon impact and stopping, they slide as if on an ice plain towards the left part of the screen and then hit another wall and stop. Im only guessing this has something to do with the tangent of the floor being 0 and thus causing all sorts of pain but i think i might just be missing something obvious here.
has anyone come across such an issue? Other than that its a great library, thanks a lot!

Ehud
Friction is not on the scale of 0..1 (I think). And also, there is a special way which the resultant friction is calculated based on the two friction values of each object. See the manual for this 😎
thanks for your reply 🙂
yes, the 2 values are multiplied. I have also tried insanely high values like 1000, still doesnt work (also doesnt seem to change much).

any ideas?
Yeah, that shouldn't happen. What happens if you use the default friciton and restitution values for all your shapes? How big are the circles? Any code would help here.
Hmm, sorry for taking so long to answer.
I am uploading 2 binaries with 2 different problems:
1. balls falling from the top of the screen are stacked on top of each other instead of rolling off each other.
it seems strange and unrealistic. the shape and body are created with normal attributes - except for densirt which is set to 1.
example:
http://www.mediafire.com/?edg1z1bgzdz

the object creation is as follows:
Code:
Ball::Ball(int x, int y, float radius_, Socket* socket_ , float mass_)
{   
   
   radius = radius_;
   socket=socket_;
   b2CircleDef ballShapeDef;
   ballShapeDef.radius = radius_;
   ballShapeDef.density = 1.0;
   b2BodyDef ballBodyDef;
   ballBodyDef.allowSleep = true;   
   ballBodyDef.position.Set(x,y);
   ballBodyDef.AddShape(&ballShapeDef);
   body = world->CreateBody(&ballBodyDef);
}


2. Balls are rolling as if there's no rolling friction (which might be true, i don't know).
the second binary contains a large stack of balls. clicking on a ball removes it from the board.
you have to play around for awhile to see it happening but at the end you'll get it.
friction of both the ball and surface are set to 1 here:
http://www.mediafire.com/?711jstt1by0

anything else that I can do to help let me know and i will send it.

Thanks Erin and everyone else!
You need to add a bit of randomization to the x position of the newly spawned balls if you don't want them to stack like that.

As for the second example, I couldn't exactly tell what was wrong with the way it was working, it looks right to me...care to elaborate?
Hi, I ran your examples. Thanks for putting them together. This makes problems much easier to diagnose.

1. This is the expected behavior. The spheres are exactly aligned, so no horizontal forces develop. You can avoid sphere stacking by using a small random horizontal displacement.

2. Right, there is no rolling friction in Box2D. I can certainly add this. I can also add linear/angular damping. I think I'll do the latter first. For now you can just multiply the linear/angular velocity by a number slightly less than 1 each time step (like 0.95). You can also generate some energy loss by reducing the friction. Then the circles will slide a bit more and slow down, instead of sticking and rolling.
Works great, thanks 🙂
I've multiplied both angular and linear velocity by 0.99 each timestep and it looks much better.
BTW - Kind of off topic but still - does box2d use euler or verlet integration?
I think I'll need verlet in order to simulate soft bodies using springs. If its not used, how hard would it be to change the integeration to verlet instead of euler?

Thanks again!

PS - does anyone know the differences between chipmunk and box2d? it seems to me that they are identical both in design and most features.

Original thread: https://box2d.org/forum/viewtopic.php?t=66