Archived

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

AndrewMack

Moving along a quadrilateral

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 this post


Link to post
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.

Share this post


Link to post
Share on other sites