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 );
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 ] );
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) );
Bram Stolk