Help Needed: Ogre model and physics don't match

6SS

13-08-2012 17:46:29

Hi,
I've got a problem using OgreODE in Ogre 1.7

Basically I'm loading a mesh (a football) made in 3DS Max and exported to .mesh format
I want the ball to be "physical", so I'm creating a Dynamic Sphere, like this:


mEntity = sceneMgr->createEntity("Ball", "ball.mesh");
mEntity->setCastShadows(true);
mNode = sceneMgr->getRootSceneNode()->createChildSceneNode(mEntity->getName());
mNode->attachObject(mEntity[0]);
mNode->setPosition(0, 1.2, 0);
Ogre::Vector3 size(.5, .5, .5);
mNode->setScale(size.x, size.y, size.z);
OgreOde::EntityInformer ei(mEntity, Ogre::Matrix4::getScale(mNode->getScale()));
mBody = ei.createSingleDynamicSphere(5.0, mWorld, mSpace);


So, basically, I load the mesh, create a scene node and assign the entity to it,
I position it and scale it, I create an entity informer, so to preserve the scale
and I create a sphere.

The problem is that THE PHYSICAL SPHERE does not appear in the same position as the graphical mesh.
I enabled OgreOde debug, so I can see where the physical body is.
As you can see from the attached image, the graphical ball is not where the ogreode sphere is.
I tried the exact same code with another mesh, the ball mesh that comes with ogreode, and it works perfectly!!
So I believe it must be a problem with my mesh, what can it be?
Is there a way to "manually" move the physical body to match the ogre mesh position?

I'm attaching the screenshot of the working version too...as you can see using the ball mesh that comes with the demos,
the physical body (red circle) coincides perfectly with the graphical ball..

Any help?
Thanks