Rts character movement

SiWi

02-02-2008 11:44:13

As the title says I want to do some characters that do rts movement. Therefore I divide my world into squares and run A* on it.
Now my characters have to walk along the path I got from A*.
They are running on terrain and have to run from the middle of one square to another.
How I try to do it:
-I calculate CurrentPosition-MiddleOfNextSquare
-Normalise the result
-use getRotationTo(CharacterOrientation*UNIT_Y) on result
-multiply the Quaternion with the CharacterOreintation and pass it do setDirection.
-Then I use setRawNextMovementDirection with the normalised result from above * MovementSpeed.

But I get some strange results with it:
-Sometimes the character moves very fast and sometimes it doesn´t even move a bit although the terrain seems to be pretty flat.
-Using setDirection doesn´t result in turning the Node

So my questions:
-Do you have any other ideas to do it?
-How could I get a somewhat consistent movemnt speed?
-How to match up the node Rotation with the Actor rotation?

I also have another question:
For the A* I first have to find out which squares are blocked and which are not. Atm I do a raycast in the middle of the square. If it hits nothing else, but the terrrain, it´s not blocked.
The problem is that this takes a long time when i have to do it for 512*512 squares or something like this. Can you think of a faster method then raycasting?

SiWi

09-02-2008 11:08:04

Sorry for double post, but no ideas?