Hi,
I can create a Bullet heightmap and collide with it. The results generally seem to be correct (large scale features are there). To test, I drop some objects in random places and have a look.
A perfectly flat heightmap is collided perfectly (of any height, as long as it's constant).
However, if the heightfield is sloped, objects penetrate a surprisingly far distance (seemingly related to the slope at that point).
For completeness, how the heightfield is made:
float scale[3] = {1.0f,1.0f,1.0f};
//create and fill data
btHeightfieldTerrainShape* new_shape = new btHeightfieldTerrainShape(data_size[0],data_size[1], data, 1.0f, 0.0f,scale[1], 1, PHY_FLOAT, true);
new_shape->setLocalScaling(btVector3(scale[0],1.0f,scale[2]));
offset[0] = scale[0]*data_size[0] * 0.5f;
offset[1] = scale[1] * 0.5f;
offset[2] = scale[2]*data_size[1] * 0.5f;
//translate heightmap's associated body to "offset", thus
//putting one corner of the heightmap at the origin.
Here's a screenshot from underneath a heightmap of some cubes falling on it. Notice that the cubes penetrate about 10% to 20% of their depth in!
Thanks,
-G