I am using the following constructor:
Code: Select all
btHeightfieldTerrainShape::btHeightfieldTerrainShape ( int heightStickWidth,
int heightStickLength,
const void * heightfieldData,
btScalar heightScale,
btScalar minHeight,
btScalar maxHeight,
int upAxis,
PHY_ScalarType heightDataType,
bool flipQuadEdges
)
Really? Then how come when I pass larger or smaller values into the minHeight/maxHeight parameters of the constructor, it changes the bounding box but seems to have no effect on where the actual collision boundary is created? For example, I created a btHeightfieldTerrainShape, I used the float data type and passed in an array of floats all with value 0.7. I tried various min and max heights (-5 and 2), (0.6 and 0.8 ), even (0.4 to 0.6 which doesn't even contain 0.7) and the objects in my scene still collided at the exact same location (I had a graphical object drawn at 0.7 units above the ground to inspect).NOTE: be careful with coordinates. If you have a heightfield with a local min height of -100m, and a max height of +500m, you may be tempted to place it at the origin (0,0) and expect the heights in world coordinates to be -100 to +500 meters. Actually, the heights will be -300 to +300m, because bullet will re-center the heightfield based on its AABB (which is determined by the min/max heights). So keep in mind that once you create a btHeightfieldTerrainShape object, the heights will be adjusted relative to the center of the AABB.
So... what exactly is this 're-centering' doing? And for the 2d array of height values being passed in.. what space should they be in? So in the example described above (where it gets recentered from (-100,500) to (-300,300).. do I pass in height values within the (-100,500) range or within the (-300,300) range?
Any help in understanding this would be much appreciated.