Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

digitalash

Clamping md2 model on the surface of terrain

This topic is 6199 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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[i].x)-polygon[i].normal.j*(y-polygon[i].y))/polygon[i].normal.k)+polygon[i].z);

Test the height under the centerpoint of the model, or under the both feet.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!