# who turn a moving agent to the specific coordinate

i have a moving agent in gis map that is going to the special Coordinate . with assumption that maximum angel of rotation is predefined, i want the agent turn into specified coordinate (in moving) and then go to that location, what i do for this work please help me.

• Tholle's answer is good. Take a look at steering behaviours if you haven't already. May 19, 2014 at 4:24

Imagine that you would make a vector from the moving agent straight to the target location. Instead of using this new vector as your agent's path, you can update you path slightly every iteration with your angle rotation you mentioned, so that it eventually starts going straight to the location.

Algoritm in steps:

1. Make a vector from agent to target location
2. Check which direction gives the smallest angle to rotate to face the target location
3. Check to see if this angle is below (for example) 10 degrees.

4a. If it is, simply set the path to the vector you made in step one (to avoid zig-zagging)

4b. If not, rotate your initial path-vector in this direction with your angle rotation speed.

Granted that your rotation speed is low enough, this will make the agent take a smoother path towards the target location.

Depending on what framework you are working in, a "slerp" or "lerp" function might already be implemented which is very useful!