making object stop using friction

gasim
Posts: 6
Joined: Tue Dec 03, 2013 9:31 pm

making object stop using friction

Post by gasim »

how am I suppose to apply friction to an object so that when I apply force it stops? Here are my physics objects:

Rigid Body "Sphere"
  • Collision shape: btSphereShape(0.50)
  • Mass: 1.0 kg
  • Restitution: 0.5
  • Friction: 10.0
Rigid Body "Platform"
  • Collision shape: btBoxShape( btVector3(23.0, 0.5, 23.0) ) (was btStaticPlaneShape(btVector3(0,1,0),1))
  • Mass: 0.0 kg
  • Restitution: 0.75
  • Friction: 1.0
I apply central force of btVector3(0,0,-100) on key press 'W' to the sphere. The sphere moves but never stops. Is there anything else I should take into consideration? The sphere is not rolling (the force is to the center) and the damping cannot be used because it slows the object down on any force, even gravity.

EDIT: Friction and Restitution values are corrected (I swapped them by accident). Also I changed the collision shape of the platform. The collision works and the sphere falls if it leaves the bounding volume of the platform; also with the restitution the bouncing of the sphere also works but still no luck with Friction...

EDIT2: Removed the second question. Its not my biggest concern right as I want to fix the main problem of moving objects around. I tested to see if the problem is the way I apply force. But its not - when i apply central force in Y direction (like jump: 500 Newtons), the gravity force moves it down. Also, I tried applying an impulse to see maybe that will work (its done in the Basic Demo when an object is moved by mouse) but had no luck so far. Moreover, I noticed that the total force is reset on each update cycle (I am guessing its before forces like gravity is applied). So, the problem is in friction force; I am going to try to add mass to the platform to see if anything changes.

EDIT3: I "solved" the problem by applying a negative of the total force to the rigid body. I still wasn't able to make the friction force work. I added mass to the platform object and in order to make the object unusable from any force around, I added setLinearFactor(btVector3(0,0,0)) and setAngularFactor(btVector3(0,0,0)). There was no luck in that either. I hope someone can explain to me how friction even works in this system.
bwelch
Posts: 48
Joined: Thu Dec 12, 2013 4:04 pm

Re: making object stop using friction

Post by bwelch »

I'm no expert on Bullet, but in my reading I've come across some mention of rolling friction. Since you're using a sphere on a flat surface, maybe that's what you need?
Daixiwen
Posts: 3
Joined: Wed Jun 05, 2013 10:53 am

Re: making object stop using friction

Post by Daixiwen »

Yes, I actually got this problem yesterday, and what you are looking for is rolling friction. Use setRollingFriction() on both rigid bodies (the ground and the sphere) and use setAnisotropicFriction() on the sphere. Have a look at the RollingFrictionDemo example code (RollingFrictionDemo.cpp)