View Full Version : How to move in terrain?
06-16-2001, 01:02 PM
I would like to know how to move in my basic 3rd/1st person terrain engine based on Bezier patches. It is not just transformations and translations since the terrain is not flat. I had some idea of implementing 2D Bresenham algorithm to calculate the height of the point in terrain I am standing on. The problem is that one move (pressing of move key) has some length and this length has to walked over the triangles at any walking angle.
If I knew the ending point of every move I make I could translate the scene to specific height (simple mathematic formulas).
Any links concerning this subject ?
Any links on that?
06-16-2001, 01:38 PM
One idea is to project a horizontal forward vector onto the planes of the triangles the vector is over or under. Of course this method only makes sense if you can determine which triangles the path will lie on, and that is easy to do if your triangles are in a regular grid. If the triangles are not in a regular grid (with varying heights of course) but the terrain is otherwise parametric, then you just need to solve for the heights along the path at a sufficient resolution. This may be easier done recursively by repeatedly sub-dividing the path. It all really depends upon the nature of the information regarding the terrain you have on hand.
06-16-2001, 02:01 PM
So how can I determine the triangles I shall be walking over ? At the beginning I know the starting point in my scene, then I shall rotate the scene (look around) and then I shall move forward to the ending point. But where dows he lie?
One idea that just now came to my mind. Could not I do it the way it is done in any game when you display the map for the level (A view from the top - 2D map) ? Since I have the starting point and rotation angle, using sin/cosine functions I could determine the 2d position of ending point and that would be the line (vector)which I could use for calculating intersections with edges of triangle. And when I shall know the intersection point on particular edge, I shall then also know next trinagle that I shall go over. This should be repeated until the desired length of move is reached.
DFrey: Is this what you wanted to explain?
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.