Spherical rigid body will not stop rolling?

Post Reply
bram
Posts: 51
Joined: Sun Nov 23, 2008 4:43 pm

Spherical rigid body will not stop rolling?

Post by bram »

Hi,

My spheres will not stop rolling on a horizontal static plane, even though I set both friction and rolling friction.
Why could this be?

Here's how I create the sphere:

Code: Select all

	btCollisionShape* shp = new btSphereShape( radius );
	const float mass = 0.6f;
	btVector3 inertia;
	shp->calculateLocalInertia( mass, inertia );
	obdb_shapes[ obdb_objCnt ] = shp;
	btDefaultMotionState* mst = new btDefaultMotionState( btTransform( btQuaternion(0,0,0,1), btVector3(pos[0],pos[1],pos[2]) ) );
	btRigidBody::btRigidBodyConstructionInfo rigidBodyCI( mass, mst, shp, inertia );
	obdb_bodies[ obdb_objCnt ] = new btRigidBody( rigidBodyCI );
	obdb_world->addRigidBody( obdb_bodies[ obdb_objCnt ] );
	obdb_bodies[ obdb_objCnt ]->setFriction( 1.0f );
	obdb_bodies[ obdb_objCnt ]->setRollingFriction( 1.0f );
Here's how I create the plane:

Code: Select all

	obdb_shapes[ obdb_objCnt ] = new btStaticPlaneShape( btVector3(0, 0, 1), 0.0f );
	btDefaultMotionState* mst = new btDefaultMotionState( btTransform( btQuaternion(0, 0, 0, 1), btVector3( pos[0], pos[1], pos[2] ) ) );
	btRigidBody::btRigidBodyConstructionInfo rigidBodyCI( 0.0f, mst, obdb_shapes[ obdb_objCnt ], btVector3(0, 0, 0) );
	obdb_bodies[ obdb_objCnt ] = new btRigidBody( rigidBodyCI );
	obdb_bodies[ obdb_objCnt ]->setFriction( 1.0f );
	obdb_world->addRigidBody( obdb_bodies[ obdb_objCnt ] );
And I got the boiler plate world construction from the wiki's hello world example.

Code: Select all

	// Build the broadphase
	btBroadphaseInterface* broadphase = new btDbvtBroadphase();
	
	// Set up the collision configuration and dispatcher
	btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
	btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
	
	// The actual physics solver
	btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
	
	// The world.
	world = new btDiscreteDynamicsWorld( dispatcher, broadphase, solver, collisionConfiguration );
	world->setGravity( btVector3(0, 0, -9.8f*0.85f) );
Thanks!

Bram Stolk
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Spherical rigid body will not stop rolling?

Post by Erwin Coumans »

What is the radius of the sphere? Have you compared your setup with the Bullet/Demos/RollingFrictionDemo?
Thanks!
Erwin
bram
Posts: 51
Joined: Sun Nov 23, 2008 4:43 pm

Re: Spherical rigid body will not stop rolling?

Post by bram »

Erwin Coumans wrote:What is the radius of the sphere? Have you compared your setup with the Bullet/Demos/RollingFrictionDemo?
Thanks!
Erwin
My radius is 0.05 but changing it to 1.0 did not help.
I don't see any obvious differences in setup with the rolling friction demo.
Post Reply