Sign in to follow this  
crippeli

Collision detection for heightmap terrain

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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,

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this