• News

• Industries

• Learning & Support

• Community

• Marketplace

# Turning radius for AI?

I have some AI creatures in my game that walk around but when they start moving towards their next target, they just snap towards it instead of rotating around to face their target and then start walking towards it. Is there a way I could add a turning radius to my AI?

You can tweak the CharacterMovementComponent to your liking :

That makes it start to move in a direction and the mesh rotation will be lagged behind the actual movement. I want an actual curve. This is what your solution looks like, but I want something that looks like this:

https://forums.unrealengine.com/core/image/gif;base64

The black line is the path the AI will follow and the red dot is the AI, which is facing directly to the right but curves towards the path as it travels down it.

You could use “Find look at rotation”, and plug the yaw into yaw of SetActorRotation. The “start” is your enemy, and “target” is the player.

Wouldn’t that just do make it snap to face towards the player? I want it to follow a curve to turn around.

I’m using it currently and the enemy rotates to face me.

``````
https://imgur.com/a/l5DyNCg

``````

I’m looking for a way for the AI to follow curve to turn towards the player. Not get snapped to look in the direction of the player. Take a look at the image I posted above to see what I’m trying to do.

Ah, sorry. I saw the image and din’t understand it, you want the enemy to still have velocity while turning, some kind of arc. I don’t have any way to help you with that… =/

Yeah thats exactly what I’m looking for.

Maybe you could do something with RInterp To, I think Interp speed, is what sets the rotation?

The info window also says that it gives a “nice smooth feeling when rotating to target” So just add velocity and reduce the look at rotation?

Yeah but that doesn’t solve the issue of calculating a circle to turn around on.

This sounds pretty complex.

Just talking here, because I could absolutely not do this, but sounds like you’ll need to have some sort of algorithm to determine a curve between 2 points. You’ll then need to generate points along that curve in 3d space.

Again, no idea how to actually do this though.

hm okay. I’ll have to do some research on an algorithm to do that.

Even if I find an algorithm for that, how could I implement it? I’m using black boards for my AI and I have no idea how I would create this.