# AI patrol moving along spline

**URL:** <https://forums.unrealengine.com/t/ai-patrol-moving-along-spline/392583>\
**Category:** AI\
**Tags:** ai-navigation, nav-mesh, unreal-engine, Spline, question\
**Created:** [May 3, 2017, 2:13pm UTC](https://forums.unrealengine.com/t/ai-patrol-moving-along-spline/392583 "2017-05-03T14:13:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hidrogen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hidrogen](https://forums.unrealengine.com/u/hidrogen)\
**Post date:** [May 3, 2017, 2:13pm UTC](https://forums.unrealengine.com/t/ai-patrol-moving-along-spline/392583/1 "2017-05-03T14:13:23Z")

</div>

I have defined a spline path to move my first player pawn actor (like 2.5 sidescroller style game).  
I want to define some point of this spline as target point for my AI Bot to patrol, and want this AI BOT move along the same spline to reach the targets.

Do you have any suggestion to how do that?

---

<div class="post-metadata">

**Author:** ![HuoCrazeh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HuoCrazeh](https://forums.unrealengine.com/u/HuoCrazeh)\
**Post date:** [May 18, 2018, 8:13pm UTC](https://forums.unrealengine.com/t/ai-patrol-moving-along-spline/392583/2 "2018-05-18T20:13:09Z")

</div>

Hello i have been learning Splines as of late and i have made some progress

> **[May 18, 2018 12:58 PM.webm](https://drive.google.com/file/d/12cqXRn-dkQ6ApH1bb6Myyhxj7FEXA3gV/view)**
>
> Google Drive file.

This is a video of my Ai at work well walking

Patrol is what makes the location along the spline  
Ai spline movement is well the location

 ![241459-spline-picture-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/a/d0a83f856aae847bc8f3abe040711a1abb323caf.png)

Path Switch is for my ai it will see you then stop going on the spline and go after someone. stop then come back to its same position to start

 ![241460-spline-picture-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/6/6d672a4b66a1dbb4dc1d93eb8290cd342b7058de.png)

You will need the variable names Location Along Spline and  
Walking speed both being float

![241471-spline-picture-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/c/05cbee00db330b2f5391b09b394d78f2c3d1532a.png)

Location along spline at 0 is at the beginning of the spline and 500000 or somthing like that being the end  
and the way i made this is it can loop if its at its max it sets it to 0 and goes through again

---

<div class="post-metadata">

**Author:** ![HuoCrazeh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HuoCrazeh](https://forums.unrealengine.com/u/HuoCrazeh)\
**Post date:** [May 21, 2018, 7:02pm UTC](https://forums.unrealengine.com/t/ai-patrol-moving-along-spline/392583/3 "2018-05-21T19:02:04Z")

</div>

the first photo the very right is nothing i just made them connect for if i wanted i could add more

---

<div class="post-metadata">

**Author:** ![Altemis92](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Altemis92](https://forums.unrealengine.com/u/Altemis92)\
**Post date:** [October 23, 2023, 8:54pm UTC](https://forums.unrealengine.com/t/ai-patrol-moving-along-spline/392583/4 "2023-10-23T20:54:43Z")

</div>

Thank you for your solution. Looks promising. But when do you call „patrol“and path switch?
