Collision detection for heightmap terrain

Started by
6 comments, last by SquareDanceSteve 18 years, 9 months ago
Hello there chaps. I'm wondering, what is the best/easiest way to do collision detection on a heightmap terrain? I've loaded a terrain from a simple bmp-file and rendered it as vertices. Now i want to be able to "walk" through the terrain, without moving through polygons or falling through the "ground". How can I make the camera move up slopes etc? Thanks in advance! /Christian
Advertisement
Basically, you take the height of the terrain at the point where the camera/model is located, then you put in an arbitary value to raise it off the floor. You can smooth it out by using the height values of adjacent vertices and averaging etc.
Thanks, i'll give that a try. :)
Okay, it works now. But it's a little too choppy. Could you give an example on how to smoothen the translation from one height to another?

/ Christian
At first i would add a check if the value you
rise the camera is not too big, otherwise you could just hop
and mountan up and don't think thats your idea:D.

With smouthing out, im not that good at math but i think
that you could check the points around the player and calculate
the current height at the point you are (using pytagoras).

I hope this will help:D but i don't think so becouse
im not good at explaining math.

Tjaalie,
if (*pYou == ASSHOLE) { pYou->Die(); delete pYou; };
Quote:Could you give an example on how to smoothen the translation from one height to another?
One way to do this is with barycentric coordinates. Try googling for that topic; also, you may be able to piece it together from this thread.
Thanks for your help. :)
here ya go... code and all

http://www.gamedev.net/community/forums/topic.asp?topic_id=304322
-----------------www.stevemata.com

This topic is closed to new replies.

Advertisement