Jump to content
  • Advertisement
Sign in to follow this  
crippeli

Collision detection for heightmap terrain

This topic is 4707 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

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
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.

Share this post


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

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
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!