Problem with friction [solved]

Psicoder

16-11-2007 15:25:03

Hi, i'm new in physics simulation and i'm getting a problem with friction...
in fact the problem is that there is no friction at all.

i got a static plane with a friction coeficient of 1

when i throw a spheres with friction coeficient of 1 too they dont stop unless they collide each others.




//The plane
OgreBulletCollisions::CollisionShape *Shape = new OgreBulletCollisions::StaticPlaneCollisionShape (Vector3(0,1,0), 0);

OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody("Plane", mPhysicsWorld);

defaultPlaneBody->setStaticShape (Shape, bodyRestitution, bodyFriction);

//the ball
entShape = new OgreBulletCollisions::SphereCollisionShape(3);
entRBody = new OgreBulletDynamics::RigidBody("PlayerBody",BGEApp::getSingletonPtr()->mPhysicsWorld);
entRBody->setShape(_Entidad->getParentSceneNode(), entShape, restitution, friction,mass, Vector3(0,5,0));

//my main loop is
if (!initialise())
return;
StateManager::getSingletonPtr()->changeState(GUI);
unsigned long Time1=0;
mMainLoopTime = 1;

while(StateManager::getSingletonPtr()->getCurrentState() != END)
{

Time1 = Root::getSingletonPtr()->getTimer()->getMilliseconds();
if(StateManager::getSingletonPtr()->getCurrentState() == LOADING)
{
createScene();
StateManager::getSingletonPtr()->changeState(GAME);
}

mInputManager->capture();

captureFrameEvents();

processEvents();

Ogre::WindowEventUtilities::messagePump();


if(Debug==true)
updateStats();

Root::getSingletonPtr()->renderOneFrame();


mPhysicsWorld->stepSimulation(mMainLoopTime);
// mPhysicsWorld->getDebugDrawer()->setDebugMode(OgreBulletCollisions::DebugDrawer::DBG_DrawContactPoints);
//setShowDebugShapes(
if(StateManager::getSingletonPtr()->getCurrentState() == GAME)
{
// entBRigidBody->applyForce(Vector3(-1,0,0)*2.5,entBRigidBody->getCenterOfMassPosition());
//entBRigidBody->forceActivationState();


}
mMainLoopTime = Root::getSingletonPtr()->getTimer()->getMilliseconds() - Time1 ;

}

destroyScene();



i've been looking around for some one with the same problem, but did'nt find nothing.

thx!

Chaster

17-11-2007 03:20:35

I'm not 100% certain, but I believe that *rolling* friction is not modeled in Bullet (at least, not for spheres). Theoretically, you could simulate it by damping the angular velocity of the bodies, but I haven't tried it.

Chaster

Psicoder

19-11-2007 00:54:24

thx that seems to be the problem. When i try it i'll edit to confirm.