I've been trying to get OgreOde into my app, and well, it works but not as supposed to. I'm sure the mistake is somewhere among these lines as Monster's OgreOde tutorials work fine; however, the damn thing beats me as I was unable to spot the source of the problem after five hours of looking through and trying. I know this sounds very lame, but if someone would by any chance find the problem here, I'd be overly glad...
This snippet creates the OgreOde world:
Code: Select all
GamePhysicsTerrainListener::GamePhysicsTerrainListener(const String& mapname)
{
_world = new OgreOde::World(mgr);
_world->setGravity(Vector3(0,-9.80665,0));
_world->setCFM(10e-5);
_world->setERP(0.8);
_world->setAutoSleep(true);
_world->setContactCorrectionVelocity(1.0);
_world->setShowDebugObjects(true);
lt = new Col_Listener(); //That's the collision listening class.
_world->setCollisionListener(lt);
_terrain = new OgreOde::TerrainGeometry(mapname,_world->getDefaultSpace());
_terrain->setHeightListener(this);
_stepper = new OgreOde::ForwardFixedQuickStepper(0.001);
_stepper->setAutomatic(OgreOde::Stepper::AutoMode_PostFrame,root);
_stepper->setStepListener(lt);
_space = _world->getDefaultSpace();
}
Code: Select all
void GamePhysicsTerrainListener::addNewObject(SceneNode* node)
{
OgreOde::MeshInformer mi;
OgreOde::BoxGeometry* playerg = mi.createSingleStaticBox(node);
OgreOde::Body* playerb = new OgreOde::Body();
playerb->setMass(OgreOde::BoxMass(1, size));
node->attachObject(playerb);
playerg->setBody(playerb);
LogManager::getSingleton().logMessage("NOTE: OgreODE object added.");
_geoms.push_back(playerg);
_bodies.push_back(playerb);
}
Code: Select all
class Col_Listener : public OgreOde::CollisionListener
{
public:
Col_Listener(){}
~Col_Listener(){}
virtual bool collision(OgreOde::Contact* contact)
{
LogManager::getSingleton().logMessage("COLLISION!!!");
return true;
};
};



