dudeabot
29-12-2007 16:20:48
im using the code from
http://www.ogre3d.org/wiki/index.php/Qu ... ion_Primer
it works for nodes.. but i need to make the body rotate
here is the code:
the next line would be
but what do i use for the body to move?
i was trying setOmega on the forceCallback, but Omega expects a Vector3, and mOrientDest is a quaternion
also i know setPositionOrientation() is bad, and cant go for it ;(
http://www.ogre3d.org/wiki/index.php/Qu ... ion_Primer
it works for nodes.. but i need to make the body rotate
here is the code:
mOrientSrc = get_body_orientation(ninjaBody);
mDirection = BodyUtil::get_body_position(cameraFPS->cam_body) - BodyUtil::get_body_position(ninjaBody);
Vector3 src = get_body_orientation(ninjaBody) * Vector3::NEGATIVE_UNIT_Z;
src.y = 0; // Ignore pitch difference angle
mDirection.y = 0;
src.normalise();
Real mDistance = mDirection.normalise();
quat = src.getRotationTo(mDirection);
mOrientDest = quat * mOrientSrc;// We want dest orientation, not a relative rotation (quat)
the next line would be
ninjaNode->setOrientation(mOrientDest );
but what do i use for the body to move?
i was trying setOmega on the forceCallback, but Omega expects a Vector3, and mOrientDest is a quaternion
void Poli3DListener::bodyCallback(OgreNewt::Body* me)
{
Ogre::Real mass;
Ogre::Vector3 inertia;
me->getMassMatrix(mass, inertia);
Ogre::Vector3 force(0,-9.8,0);
force *= mass;
me->addForce( force );
me->setOmega(???);
}
also i know setPositionOrientation() is bad, and cant go for it ;(