wilsonwing
29-01-2009 04:26:42
Hi.
I've read almost every topic about moving on constant speed.
And tried a long time to implement it.
But still it doesn't seem working...
I am now coding like this in my forceCallback
And I have my character Friction with terrain set "setDefaultFriction( 0.4, 0.3);".
Could someone give me some suggestion?
THANKS
I've read almost every topic about moving on constant speed.
And tried a long time to implement it.
But still it doesn't seem working...
I am now coding like this in my forceCallback
pNewtonBody = m_pCharacter->getBody();
Ogre::Vector3 currVelocity = pNewtonBody->getVelocity();
Ogre::Vector3 delta, force;
force = quat _desireDir * m_MoveForce * mass; //to rotate to desire direction m_MoveForce is Vector3(0,0,200), if moving forward; Vector3(0,0,-200), backward, for example.
delta = (force - currVelocity ); // the lack force since last forceCallback
force += delta ; // add up the lack force since last forceCallback
m_pNewtonBody ->setLocalForce( force );
And I have my character Friction with terrain set "setDefaultFriction( 0.4, 0.3);".
Could someone give me some suggestion?
THANKS