Terrain Interpolation Issue

subquantum

23-10-2007 18:50:21

Hi. I'm using OgreODE with the default terrain scene manager, and while I've managed to make the TerrainGeometry match up with the ogre geometry in size and height, there are a few places - especially where the heightfield changes rapidly - where the ODE heightfield doesn't match up with Ogre's terrain and my collision bodies either dip into the ground or collide above the surface. I've looked at ODE's heightfield code, and I see how they take the nearest points on the heightfield and make a plane for collision... but what happens when the four heightfield points that surround my colliding object don't form a nice plane? Is this just a conflict between the way Ogre renders the heightfield and the way Ode interpolates it's geometry, or could it be something else?

Also, for anyone who's interested, here's the relevant section on how I get the terrain manager synced up with the TerrainGeometry (My terrain is 10,000x10,000x1400, with a normal greyscale heightmap that's 513x513):

Ogre::Vector3 scale(10000.0/512.0, 1400.0, 10000.0/512.0);

terrain = new OgreOde::TerrainGeometry(world,
world->getDefaultSpace(),
scale,
513,
513,
512 * scale.x,
512 * scale.z,
false);