cybeer
20-04-2011 20:26:56
Hi!
I recently started to experiment with nxogre and critter, i'm working on a project which simulates natural disasters. First of all, i created an ogre terrain, following the terrain tutorial and then i tried to create a collision mesh for it. I followed some code samples, they were basically the same:
1. create the terrain in ogre
2. setup up physx:
It works, the terrain collision mesh is created, i can view it when i enable the visual debugger, but the position is wrong You can see the results in this screenshot:
http://kepfeltoltes.hu/view/110420/terrain_www.kepfeltoltes.hu_.jpg
Sadly, if i change the position of the ogre terrain, the collision mesh is moving with it
What am i doing wrong? It's a bug? I really really appreciate any help! Thanks!
I recently started to experiment with nxogre and critter, i'm working on a project which simulates natural disasters. First of all, i created an ogre terrain, following the terrain tutorial and then i tried to create a collision mesh for it. I followed some code samples, they were basically the same:
1. create the terrain in ogre
2. setup up physx:
.....
mWorld = NxOgre::World::createWorld();
mWorld->getRemoteDebugger()->connect();
// Create the scene
NxOgre::SceneDescription scene_description;
scene_description.mGravity = NxOgre::Constants::MEAN_EARTH_GRAVITY;
scene_description.mUseHardware = true;
mScene = mWorld->createScene(scene_description);
// Set default material properties
mDefaultMaterial = mScene->getMaterial(0);
mDefaultMaterial->setRestitution(0.1f);
mDefaultMaterial->setDynamicFriction(0.9);
mDefaultMaterial->setStaticFriction(0.5);
mScene->createSceneGeometry(NxOgre::PlaneGeometryDescription());
// Create the rendersystem.
mRenderSystem = new Critter::RenderSystem(mScene, mSceneMgr);
//set up the terrain
NxOgre::SceneGeometry * sg;
Ogre::TerrainGroup::TerrainIterator ti = mTerrainGroup->getTerrainIterator();
while (ti.hasMoreElements())
{
Terrain * t = ti.getNext()->instance;
sg = mRenderSystem->createTerrain(t);
}
It works, the terrain collision mesh is created, i can view it when i enable the visual debugger, but the position is wrong You can see the results in this screenshot:
http://kepfeltoltes.hu/view/110420/terrain_www.kepfeltoltes.hu_.jpg
Sadly, if i change the position of the ogre terrain, the collision mesh is moving with it
What am i doing wrong? It's a bug? I really really appreciate any help! Thanks!