Clamping md2 model on the surface of terrain

Started by
0 comments, last by digitalash 22 years, 3 months ago
Hi, i have loaded an md2 model(followed nehe tut.) i also have a terrain. i want to move the md2 model on the terrain. i have the terrain heightmap. if i have to keep the model on top of the terrain always then i have to clamp the model using the terrain height values, for this how can i retrieve the position of the bottom most point of the model? kindly correct me if my approach i wrong? also suggest a method to implement the same Regards DiGiTaL-AsH
Ashwin "DiGiTaL-AsH" Desikan
Advertisement
I am not sure what you mean, but if you are look for a way to calculate the height of the terrain under the model...

i=number_of_the_polygon_where_the_point_x_y_lies_on;
height_under_point_x_y=(((-polygon.normal.i*(x-polygon.x)-polygon.normal.j*(y-polygon.y))/polygon.normal.k)+polygon.z);<br><br>Test the height under the centerpoint of the model, or under the both feet.<br><br> </i>

This topic is closed to new replies.

Advertisement