Bleeding Terrain Issue

Kroz00

23-03-2009 09:52:54

Sup,

theres like 5 terrain threads...but none of them have the answers I need :(

Ok for all of you that want the code to create Heightmaps with Bleeding...here it is.


// create NxWorld, a main physic object
// log: yes/no
// ogre time controller means rhat ogre will care about it
mNxWorld = new NxOgre::World("time-controller:ogre, log:yes");

// create scene, you can have maximum 32 scenes, object from one scene can't
// collide with objects from another (maybe in another versions :D )
// gravity: yes/no/0 -9.788 0
// floor: create infinity floor, yes/no
// ogre will be used as debug renderer
mNxScene = mNxWorld->createScene("NxOgreScene", mSceneMgr,"floor:yes, controller: accumulator, renderer:ogre");
mNxScene->setGravity(Ogre::Vector3(0.0, -9.8, 0.0));

//load height map :D yay
NxOgre::ShapeParams sp;
NxOgre::Resources::ResourceSystem::getSingleton()->addHeightfieldAs("file://terrain.xhf", "terrain");
NxOgre::Resources::Heightfield* hf = NxOgre::Resources::ResourceSystem::getSingleton()->getHeightfield("terrain");

mNxScene->createActor("terrain", new NxOgre::Terrain(hf, NxOgre::float3(512,50,512), "", "centering: xz-above, hole-material: 65535"), Ogre::Vector3(0,-50,0), "static: yes");

//Display Terrain

std::string terrain_cfg("terrain.cfg");
mSceneMgr->setWorldGeometry( terrain_cfg );
// Infinite far plane?
if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
{
mCamera->setFarClipDistance(0);
}


I am working with the standard: terrain.png, converted to terrain.raw via Photoshop CS4. then compiled via flour 0.3.2 into terrain.xhf

OgreSDK 1.4.9
NxOgre: 1.0.25
PhysX SDK - 2.8.1
Stock Terrain.png from Ogre's texture directory.

For some reason PhysX needs the -50 Y position.
I apologize if this is a repost but i spent a good 4 hrs search for this over the past 2 days :P

betajaen

23-03-2009 10:45:28

I'm not exactly sure what you want, but if you want the terrain to match your visual terrain in Ogre using the Terrain SceneManager. Try changing the coordinates of the actor to 0,0,0 and the centering param to none.