• News

• Industries

• Learning & Support

• Community

• Marketplace

# Physics based AI movement?

Hey All,

Just a quick one (that’s a lie it never is)

I’m trying to make AI pawns move using Physics, I have this working with set rotation but its an instant movement and looks terrible, plus the players’ movement is all physics and would be unfair.

So **given a location, how would I get an AI to face that location and stay facing it (constant correction) while it impulses towards it? **

Abstract answers are cool but iv only been at this since quarantine so an ELI5 would be fantastic.

A clip of the project so far:https://youtube.com/watch?v=oRYxEejBVT0
Cheers,

Ok, Been pulling apart rotators and testing print strings and managed to get this…

it’s really janky but it works! (EDIT Sometimes) if anyone has or can easily figure out a more elegant solution id really love to hear it!

Cheers!

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_192465_1589838648794_118”}[/ATTACH]

For anyone passing through, Any idea why X-Roll funks up Pitch/Yaw movement/navigation? It seems to get to 90Deg or so and the pawn starts to drift off and wander about.

Does “add angular impulse” add velocity from the world location point of reference?

Or is the impulse the same but the target and your calculations towards the target not representative any more?

would roll after 90 have to modify your calculations somehow?

I’m at a loss, please send help.

Cheers!

UPDATE:

I’m a little further now and have about 75% tracking ability literally.

Lerping over signing for the angular force multiplier gives a miles smoother transition,

Getting the current position and seeing if the pawn is facing “backwards” or not, and fliping the angular force if it is has given nearly full range.

For some reason -90 to -180 degrees send the pawn into a drift but it will restore tracking when the target is back within -90 to 180.

If anyone has any ideas I’m all ears,

Cheers.

Video Demo: https://youtu.be/cTolTNVoZzU