How can i change player speed in run-time?
I put this code inside of controller update since i want to change it in run time but didn't work:
After that i tried this:
input.m_velocity = m_pOgreHavokBody->getHavokBody()->getLinearVelocity(); input.m_velocity.mul(m_speed);
With a range of values [2.0f..2.5f] i didn't notice any changes and with the range [2,5f..3.0f] or more it's too fast.
EDIT: it seems when i press forward + strafe right or left it raises velocity with the ranges [2.0f..2.5f], it seems that is adding velocity in the wrong axis(diagonal).
Ogre::Vector3 dir = cGraphicalInterface::getSingleton().getCamera()->getDirection(); input.m_forward.set( dir.x,dir.y,dir.z);