• News

• Industries

• Learning & Support

• Community

• Marketplace

# Creating natural movement for an AI?

Currently my AI just “teleports” to face its target when walking but I want it to go around in a circle to reach its target. I made something in paint showing what I’m trying to achieve:

I’ve tried turning off “Use Controller Rotation Yaw” and in my AI’s CharacterMovement component’s Rotation Settings putting a small rotation rate around Z axis. But this doesn’t create what I’m trying to do, as it only slowdown the mesh rotation, but the path the character follows is still a sharp path, making it look even weirder because the character moves backwards while slowly rotating.

I thought maybe I could do it with a spline but I have no idea how I would get the AI to smoothly follow a curve and I would want it to be possible for the path to change while the character is moving to its target (but is that even really needed?)

Is this how you move when you move towards a target? Weird.

Anyway, have you considered using a logarithmic spiral to create the path?

The drawings are when the AI moves too and from a target.

How would I go about doing that, would I use a spline?

Consider for example the most basic log. spiral equation possible (in polar form): r = a[SUP]alpha[/SUP], with the final target position you have all you need (the final *r *and alpha) to determine a.

Now that you have the parameter a, it’s a question of calculating points on the curve (x,y), by varying alpha from 0 -> angle(target, AI), and make the AI go through these.

](filedata/fetch?id=1800096&d=1597259849)