#### Archived

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

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

## Recommended Posts

I''m programming a game in 3D and have run into a bit of road-block. I have a landscape, represented by quadrilaterals for tiling, and then I have units, models or a quad with a texture over it, moving over the landscape. At first I programmed this to run with the landscap tiles with a Z of 0. But now I''ve made it so the tiles have different heights with intermediary tiles and such. My question is how do I get it so that the units will move along the intermediary tiles so that they won''t go through the ground. Basically I want them to go along the same line as the tile. I''ve been trying out tons of stuff such as using the breshenham line equation thing (for lack of a better word) so that it will find the ''slope'' of the tile and then have it move up at that slope. This seems like something very basic that most first person shooter programmers would know how to do (having the camera stay above the ground at a certain height.) Any help would be greatly appreciated. -Thanks

##### Share on other sites
Ok here is my advice. If you are using OpenGL, which I think you are. Go to the OpenGL Programming Book page. There download the zip file for chapter 21. Chapter 21 is where you make a first person shooter. In the game you go up and down the terrain. I think this is what you are talking about. I do have the book, and I haven''t finished yet so I am not sure how to do it. I think the terrain is made using eaither a triangle list, or display list. I am not sure. I would study the code in terainne.cpp for your answer.

1. 1
2. 2
3. 3
Rutin
20
4. 4
frob
20
5. 5

• 32
• 13
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
632560
• Total Posts
3007084

×