PDA

View Full Version : Terrain Hugging / Height Detection



Sogekihei
04-07-2005, 03:09 PM
Hi, does anyone know how I can detect the height of a face directly beneath a model? I have some terrain and a ship and I basically want the ship's height to change depending on the height of the terrain beneath it so that it appears to hug the terrain as it moves (like in the wipeout or fzero games). Any help appreciated, thanks

sephox
04-07-2005, 03:27 PM
Well if you can find some free code to do a line intersection on a plane (Used to be on gametutorials.com)... usually you can create a "plane" from a triangle (three points to define a plane) and then your line will be from your spaceship straight down below the terrain. then the y value where the line intersects the "plane" (triangle) is where you will want to put the bottom of your ship, or maybe a couple points higher to make it look like it is floating.

zukko
04-07-2005, 06:56 PM
hi, an unoptimized method would be to read the height values and save them ina an array then as you move your ship compare them

Sogekihei
04-08-2005, 01:28 AM
Thanks a lot guys, I'll give it a go