Page 1 of 1

Unit movement on 3d terrain?

Posted: Fri May 22, 2009 3:39 pm
by odenter
First of all my english isn't perfect. :)

I've a Terrain and want to move units on this terrain. But every unit should move the same distance.
How can I do this?

First idea was to have an Grid invisible over my terrain and one unit move from one quad to next quad, like in a 2d, tiled game.
Drawing a 2d grid isn't the problem but a 3d grid (mountains, river).

Any advice for me?

Posted: Sun May 24, 2009 9:45 pm
by CuteAlien
I am not exactly sure where you have the problem...

For drawing a terrain you should check the terrain rendering example (example 12).

For placing the units you do usually as you already guessed: You calculate them all as if they would move on a 2d grid. For placing them on the terrain you can adapt the height after those calculations.

Posted: Mon May 25, 2009 11:29 am
by Frank Dodd
Indeed, a 2D solution can also have the same obstacles where grid locations are water or mountainous terrain.

Posted: Mon May 25, 2009 2:21 pm
by odenter
The problem wasn't to draw a model.
The problem was I thought wrong. :P

Moveing is like in 2d (elapsedTime * something). My problem was moving on/to higher points. Maybe I want to have hills and mountains. A hill should be passable a mountain not. So how to i code this? Now I knew vectors are my friends. :)

Posted: Mon May 25, 2009 6:05 pm
by Kalango
Well, i think the more accurate solution would be to split your terrain into tiles (browse to the forums, there are solutions for tiled terrains already) and make your characters walk the ammount of tiles you want (making tiles into units of movement, sort of).
You can also have a 3d line, and make your character walk from the begining to the end of it.
Another cool solution is timed movement, you make your character walk in some constant period of time at variable speeds or vice-versa.
And also (as always, there is the hard way to do it), you can project some (arrow) mesh into your terrain and make the characters walk the projected lenght of the arrow mesh....
I would pick the timed movement idea, its accurate enought and stylish 8)