R Soul on 23/9/2017 at 12:00
This describes a simple way to have a patrolling AI perform a 180 degree turn in a way that looks natural. By default, such abrupt turns looks awful.
The simplest setup is to have two TrolPts each linked to the other with an AIPatrol link:
Inline Image:
http://catmanofiowa.com/RSoul/img/Patrol180/p180_1.gifThe problem is that each time the AI turns around it's very quick, and the AI tries to keep walking so it performs a quick, tight, loop, and it looks unnatural.
The next thing a lot of people do is replace the TrolPt with a TrolPausePt, set up an AIWatchObj link and insert a 'Face angle' action (either replacing the pause or adding to it). That's the right idea, but it still looks awful. Here's a video showing how bad it looks:
[video=youtube_share;TXW0nWBserE]https://youtu.be/TXW0nWBserE[/video]
When the TrolPausePt is made visible, it becomes clear that the AIWatchObj radius causes the actions to begin
before the AI considers itself to have arrived at the patrol point. When the actions have finished, the AI then resumes its patrol, which means it finishes heading towards the point, then does another bad turn.
[video=youtube_share;-QjuGdN5UXQ]https://youtu.be/-QjuGdN5UXQ[/video]
You can reduce the radius but the AIWatchObj timing doesn't allow for a natural looking about-turn to be made.
This is how to make it look good:
Create a marker just beyond the patrol point. Use the AIWatchObj link to have the AI go to that, then face a direction:
Inline Image:
http://catmanofiowa.com/RSoul/img/Patrol180/p180_2.gifData for the AIWatchObj link to the TrolPausePt:
Inline Image:
http://catmanofiowa.com/RSoul/img/Patrol180/p180_3.gifHere's how it looks in game:
[video=youtube_share;rAWLBGOKb6Y]https://youtu.be/rAWLBGOKb6Y[/video]
With the two objects made visible, you can see how the guard walks past the TrolPausePt and gets close to the marker. When the AIWatchObj actions have finished, he still heads to the TrolPausePt but he's already facing the correct direction:
[video=youtube_share;xRyvep3ouW4]https://youtu.be/xRyvep3ouW4[/video]
LarryG on 23/9/2017 at 14:18
Nice idea.
Just out of curiosity, why did you not have the AI turn relative to itself or relative to the marker's orientation? If you don't specify anything, isn't the angle relative to the world?
R Soul on 23/9/2017 at 14:38
I've rarely even thought about relative angles, so I always use absolute values. However, the main point of the first post is to encourage people to do a few extra steps to improve their AI patrolling. The exact means of getting them to face a certain direction is down to the user's preference.
LarryG on 23/9/2017 at 15:42
Fair enough.
Yandros on 24/9/2017 at 03:13
Excellent idea, Robin. Thanks for the demo.
gamophyte on 26/9/2017 at 06:01
I love how we're in the youtube era of dromeding to actually show things in action. Thank you for this!
nicked on 26/9/2017 at 08:01
This is a great idea - it's so simple it feels like common sense, but looks really good, like "Why didn't I think of that!?". :D
ObservingEye on 26/9/2017 at 18:42
Nicely put. Perfect that you made this topic too, I'm at the stage of putting in patrolling ai in my FM.