[Solved] High friction, objects sliding like on ice

TheSHEEEP
Posts: 4
Joined: Fri Mar 07, 2014 11:13 am

[Solved] High friction, objects sliding like on ice

Post by TheSHEEEP »

Hey,

I have a question about friction in Bullet.

My setup is the following: There is a static plane (imagine a completely flat terrain) and some boxes drop down and collide with each other and the plane.

Now, even though I set both the rigid body of the plane and those of the boxes to have ridiculously high friction (20.0+, assuming that something between 0 and 1 would be normal), the boxes slide and slide as if they were on ice. They do stop after a time, but it seems to have nothing to do with the friction I set up.

Here is how I setup the plane:

Code: Select all

mPlaneShape = new btStaticPlaneShape(BulletMath::convert(normal), d);
btVector3 inertia;
mPlaneShape->calculateLocalInertia(0.0, inertia);
mPlaneActor = new btRigidBody(0.0, 0, mPlaneShape, inertia);
mPlaneActor->setFriction(20.3f);
mPlaneActor->setRollingFriction(20.3f);
And here is how I setup the boxes:

Code: Select all

btRigidBody* rigidBody = new btRigidBody(mass, motionState, shape, inertia);
rigidBody->setFriction(200.3f);
rigidBody->setRollingFriction(200.3f);
I tried with different values for the friction, but nothing seems to have any noticeable effect. Collision works fine.

What am I doing wrong here?

Mass question:
No matter what I set for the mass, the objects do not behave differently, a multiple ton object bouncing around like a plush toy. Is there something else to do for mass to be applied? Or could this even be related to the first problem?
Last edited by TheSHEEEP on Fri Mar 07, 2014 4:05 pm, edited 2 times in total.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: High friction, objects sliding like on ice + Mass questi

Post by Flix »

There are a lot of Bullet Demos in which objects behave correctly, so it must be something wrong in your setup.

I suggest you use a btBoxShape instead of a plane shape (like in the demos). What plane shape are you using ?

As far as the mass problem is concerned, it might be related to the first; however remember that without air a helium-baloon and an elephant both fall at the same speed (well, more or less :?: ).
TheSHEEEP
Posts: 4
Joined: Fri Mar 07, 2014 11:13 am

Re: High friction, objects sliding like on ice + Mass questi

Post by TheSHEEEP »

Flix wrote:I suggest you use a btBoxShape instead of a plane shape (like in the demos). What plane shape are you using ?
Ah, yes, I forgot to add that, I will edit my original post with that information.
Why should I have to switch to btBoxShape? Is btStaticPlaneShape not sufficient here?
Flix wrote:As far as the mass problem is concerned, it might be related to the first; however remember that without air a helium-baloon and an elephant both fall at the same speed (well, more or less :?: ).
Sure, but the elephant should not bounce off the surface exactly like the balloon ;)

I will have a look at the demos again, maybe I see something that I forgot.
TheSHEEEP
Posts: 4
Joined: Fri Mar 07, 2014 11:13 am

Re: High friction, objects sliding like on ice + Mass questi

Post by TheSHEEEP »

Got the solution (for both problems):

Somehow, I assumed increasing the mass also affects the restitution, which is of course nonsense.
I have to set the restitution of the boxes to a value that is not zero. Makes sense. Once that is done, the friction settings start applying. Though I do wonder why the restitution defaults to 0, basically cancelling friction.

Now the only thing I am still faced with is that each box seems to shake/tremble (as if a small earthquake is happening) before it ceases moving altogether, but I guess that is a threshold setting of some sort. This also happens to the camera that is attached to the player, though only in debug mode...
ENGine
Posts: 15
Joined: Thu Feb 26, 2015 7:04 am

Re: [Solved] High friction, objects sliding like on ice

Post by ENGine »

Hi,

I'm facing with task - creating of hickey simulator. Could you help me?
What params(setFriction, setRollingFriction) are for plane and object?
What are you controlling the object(force or linearVelocity)?

It will be great if you could share this fragment of code. Thanks a lot.