Terrain w/ Newton

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
pdovy

Terrain w/ Newton

Post by pdovy »

I'm trying to get collision detection working on my terrain mesh, the mesh is simply generated using the addTerrainMesh function and a heightmap etc...

Then I figured using a physics engine would be the best route to go, so I got Newton and fired it up and... not quite the results I hoped for. By that I mean that just using cubes on a completely flat mesh, they fly right through, or land above, topple around, and drop down through the mesh.

Then I loaded a BSP map instead of my terrain mesh (literally only need to change 2 lines of code), and voila the collision works perfectly. I can't imagine why this is... except that maybe it has to do with the fact that the terrain mesh created by Irrlicht isn't a solid object (its in essence one big face, it has no depth)

Any ideas? Or other ways to go about the same thing? I thought about just getting the height of the terrain and then setting the height of the vehicle that way, but im not dealing with characters, im using vehicles (i.e. larger footprint), so you would have to somehow calculate the proper angle for the object so it wasn't sticking into a mountain or something, it would be a possiblity to do that, but it seems like a crude method that probably wouldn't look too realistic
Mindl
Posts: 16
Joined: Wed Jun 30, 2004 1:42 am

Post by Mindl »

Not sure why it would do that with the addTerrainMesh, maybe try using the Terrain generator plugin of Milksahp and generating the terrain mesh that way, then load it as a regular mesh and collision should work with that no problem.

-Mindl
Post Reply