I'm sure they are, but its driving me nuts.
I copied the code from VehicleDemo - constructing the vertex and index buffer using DX - setting camera, projection and world matrices etc and the sphere mesh i drop above just won't collide with the terrain mesh.
I must be missing something, must be the coordinate system? I added no additional function call than what is already in the vehicle demo.
Any insights would be really great!
Thanks in advance!
DirectX and btHeightfieldTerrainShape are they compatible?
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
Re: DirectX and btHeightfieldTerrainShape are they compatible?
Nevermind, I got it working by debugging the terrain shape using btTriangleCallback and creating a vertex buffer from calling btHeightfieldTerrainShape::processAllTriangles(...).
But would anyone care to explain why the max height is being divided by 65535 to limit the height?
unsigned char heightFieldValue = m_heightfieldDataUnsignedChar[(y*m_heightStickWidth)+x];
val = heightFieldValue* (m_maxHeight/btScalar(65535));
Usually i see it done this way if for instance a height map file has a max value of 255:
( currentHeightInHeightMap / 255 ) * maxHeight;
to limit the height.
Thanks.
But would anyone care to explain why the max height is being divided by 65535 to limit the height?
unsigned char heightFieldValue = m_heightfieldDataUnsignedChar[(y*m_heightStickWidth)+x];
val = heightFieldValue* (m_maxHeight/btScalar(65535));
Usually i see it done this way if for instance a height map file has a max value of 255:
( currentHeightInHeightMap / 255 ) * maxHeight;
to limit the height.
Thanks.