f32 worldSize = 0.0; f32 test = 0.0; u32 size = 0; TerrainGroup::TerrainIterator ti = _terrainGroup->getTerrainIterator(); while(ti.hasMoreElements()) { Terrain* t = ti.getNext()->instance; if(t) { size += t->getSize(); if(t->getMaxHeight() > _max_height) _max_height = t->getMaxHeight(); //worldSize += t->getWorldSize(); } } worldSize = _terrainGroup->getTerrainWorldSize(); dHeightfieldDataID heightid = dGeomHeightfieldDataCreate(); dGeomHeightfieldDataBuildCallback( heightid, //getSpaceID(space), this, // pUserData ? PagedTerrainGeometry::_heightCallback, (dReal) (worldSize), //X (dReal) (worldSize), //Z size, // w // Vertex count along edge >= 2 size, // h // Vertex count along edge >= 2 REAL( 1.0 ), //scale REAL( 0.0 ), // vOffset 10.0f, // vThickness 0); // nWrapMode // Give some very bounds which, while conservative, // makes AABB computation more accurate than +/-INF. dGeomHeightfieldDataSetBounds( heightid, REAL( 0.0 ), _max_height ); _geom = dCreateHeightfield( getSpaceID(space), heightid, 1 );
As you can see I am iterating through the terrain group to get data on each piece (4 terrains) of terrain. I am getting height data back when my "PagedTerrainGeometry::_heightCallback" is called using:
_terrainGroup->getHeightAtWorldPosition(position.x, position.y, position.z);
Does anyone know of what I should be looking at, or does anyone see something I am forgetting, am I giving it the right data.
Has anyone implemented collision on paged terrain using Ode or Bullet yet?
Thanks.