tomodachi
27-09-2008 20:41:46
Yesterday I downloaded OgreNewt to try implementing physics in my engine. Today I've been making my first attempts to get it running. I've written a method to attach a physics body to an existing node (nCharacter), and following the wiki tutorial, seeing that everywhere it's done the same way, all I get is the entity of the node deforming anormally :S
Maybe I'm missing something?
This method is member of a class Physics that inherits Ogre::FrameListener and I call world->update() in every frameStarted passing it the timeSinceLastFrame value...
Any help?
Thanks in advance!
Maybe I'm missing something?
Body* Physics::setCharacter(Node* nCharacter, float fMass)
{
cout << "* Assigning physic body to character node '" << nCharacter->getName() << "'..." << endl;
float fRadius = 0.3;
float fHeight = 1.6;
Collision* coli = new CollisionPrimitives::Capsule(world, fRadius, fHeight);
Body* body = new Body(world, coli);
Ogre::Vector3 vInertia = MomentOfInertia::CalcCylinderSolid(fMass, fRadius, fHeight);
body->setMassMatrix(fMass, vInertia);
body->attachToNode(nCharacter);
body->setStandardForceCallback();
delete coli;
return body;
}
This method is member of a class Physics that inherits Ogre::FrameListener and I call world->update() in every frameStarted passing it the timeSinceLastFrame value...
Any help?
Thanks in advance!