i have atm my terrain as a simply layer and combined with real data that was created in a modelling programm for mountains.
something like this:
the player should be able to run on the mountains.
so i wonder what kind of collision detection normaly people implement for this kind of data.
my first attempt is to scan the object. i have a simply copy of the modell in memory. but if the mountains get more complex more time is needed to find the triangle the player is on.
i have 2 ideas atm but i dont know if someone would do this way.
divide the modell in different parts. ( somekind of patches ) inside the modelling programm and then save as single modells.
using an octree for the modell ( mountains )
The simplest and cheapest way if you just want the player to be able to walk on the terrain would be to find what triangle the player is on, given their x/z coordinates. (If your terrain is simply a uniform grid, this should be quite trivial)
Then given the distance between the triangles point's and the player's position, LERP between the three points of the triangle. This will give you the point on the terrain where the user should be...
However if the terrain overlaps itself in some cases (eg: caves...), or you want more complex physics, you'd best go the whole way and implement some rigid body dynamics...
I hope this helped...