fizzle
24-05-2006 00:26:40
I hava a problem with the tree collision, I have the ninja (convex hull) colliding with the ground (tree collision) i can apply forces to the ninja when he is in the air but when his feet collide with the ground i can no longer move him, he becomes immune to forces ... is that a common problem? I have walk set to 50 when i press W. Any help would be appreciated, Thanks.
P.S. the gravity appears as though the ninja is on mars is there more accurate way to do it?
void NewtonState::WalkF(OgreNewt::Body* body)
{
Ogre::Quaternion quat;
Ogre::Vector3 vec;
body->getPositionOrientation(vec,quat);
Ogre::Vector3 dir = quat * Ogre::Vector3::NEGATIVE_UNIT_Z;
//apply a simple gravity force.
float mass;
Ogre::Vector3 inertia;
body->getMassMatrix(mass, inertia);
Ogre::Vector3 force(0.0,-9.8,0);
force *= mass;
//add walk
dir*=walk*mass;
body->addForce( force );
}
P.S. the gravity appears as though the ninja is on mars is there more accurate way to do it?
void NewtonState::WalkF(OgreNewt::Body* body)
{
Ogre::Quaternion quat;
Ogre::Vector3 vec;
body->getPositionOrientation(vec,quat);
Ogre::Vector3 dir = quat * Ogre::Vector3::NEGATIVE_UNIT_Z;
//apply a simple gravity force.
float mass;
Ogre::Vector3 inertia;
body->getMassMatrix(mass, inertia);
Ogre::Vector3 force(0.0,-9.8,0);
force *= mass;
//add walk
dir*=walk*mass;
body->addForce( force );
}