netsurferj
01-07-2008 15:58:18
Hi
I am having difficulty with the heightmap using nxogre. Everything compiles and runs fine, its just that the heigtmap is not set up as it is supposed to.
I set it up as I found in the forum. I converted my .png to .raw and then to .xhf using flour. My image size is 513x513. If I make it 512 (power of 2) it still doesnt work (flour states its 362x362). In my terrain.cfg file the terrain size is 8000x8000 and height is 100.
I am using a convex mesh as the collision model for my robot. My code is:
Loading the resources:
Creating heightfield and actors:
And the robot body:
The robot is position in the sky (108), so when the game starts, the robot falls to the ground, and collides with a floor (I set floor to no when I created the scene), but does not collide with the terrain, if the terrain height is set to 0 (float3(8000,0,8000)). When it is set to 100 as in the code above, it lands in the air and with remote debugger I get the following image:
I was wondering if using a mesh would resolve all these problems, and if it would need more processing power?
I am having difficulty with the heightmap using nxogre. Everything compiles and runs fine, its just that the heigtmap is not set up as it is supposed to.
I set it up as I found in the forum. I converted my .png to .raw and then to .xhf using flour. My image size is 513x513. If I make it 512 (power of 2) it still doesnt work (flour states its 362x362). In my terrain.cfg file the terrain size is 8000x8000 and height is 100.
I am using a convex mesh as the collision model for my robot. My code is:
Loading the resources:
NxOgre::Resources::ResourceSystem::getSingleton()->addHeightfieldAs("file://terrain5.xhf", "heightfile");
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://robot.mesh.nxs","robot-mesh");
Creating heightfield and actors:
mgr->setWorldGeometry("terrain1.cfg");
NxOgre::Resources::Heightfield* hf = NxOgre::Resources::ResourceSystem::getSingleton()->getHeightfield("heightfile");
mScene->createActor("terr", new NxOgre::Terrain(hf, NxOgre::float3(8000,100,8000), "", "centering: xz-above, hole-material: 65535"), Ogre::Vector3(0, 0, 0), "static: yes");
And the robot body:
NxOgre::Resources::Mesh *convexMesh = NxOgre::Resources::ResourceSystem::getSingleton()->getMesh("robot-mesh");
mScene->createBody("moo; robot.mesh", new NxOgre::Convex(convexMesh), Ogre::Vector3(980,108,2710), NxOgre::ActorParams("Mass: 10"));
The robot is position in the sky (108), so when the game starts, the robot falls to the ground, and collides with a floor (I set floor to no when I created the scene), but does not collide with the terrain, if the terrain height is set to 0 (float3(8000,0,8000)). When it is set to 100 as in the code above, it lands in the air and with remote debugger I get the following image:
I was wondering if using a mesh would resolve all these problems, and if it would need more processing power?