I'm trying to integrate Newton physics together with a terrain heightmap. Its nothing too fancy - at the moment I'm just ripping out the terrain from the terrain tutorial and adding the physics from the Newton tutorial to a model.
The gravity works fine on the model, but it doesn't collide with the terrain at all - just falls into nothingness. Reading through lots of threads about this topic on here has given me some pointers, and it looks like the collision map isn't being built correctly. At the moment my code looks like:
Code: Select all
pxMesh = mpxLevel_TerrainNode->getMesh();
// Now create a collision tree using all the triangles in our mesh
mpxLevel_NewtonCollisionMap = NewtonCreateTreeCollision( mpxLevel_NewtonWorld, NULL );
NewtonTreeCollisionBeginBuild( mpxLevel_NewtonCollisionMap );
nMeshBufferCount = pxMesh->getMeshBufferCount();
for( nLoop = 0; nLoop < nMeshBufferCount; nLoop++)
{
//etc etc
Also... in loads of Newton threads I keep seeing references to some mysterious variable called 'IrrToNewton'. This doesn't seem to be defined anywhere that I can see - what is its value and where (if anywhere) can it be found? Am I missing some important #include file?