# How can a use Blueprint to make vehicle AI that follow the player vehicle?

**URL:** <https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106>\
**Category:** AI\
**Tags:** ai-navigation, vehicle-advanced-tem, unreal-engine, artificial-intellige, question\
**Created:** [December 24, 2016, 4:33am UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106 "2016-12-24T04:33:49Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![CallumFTW](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CallumFTW](https://forums.unrealengine.com/u/CallumFTW)\
**Post date:** [December 24, 2016, 4:33am UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/1 "2016-12-24T04:33:49Z")

</div>

Making a game in which i need the vehicle AI to go to the player location. I want the AI vehicles to be able to smash into the player vehicle and cause damage. So far I have had limited success using the available tutorials. I tried adapting character AI tutorials but adjusting the procedure to fit a vehicle game caused issues.

---

<div class="post-metadata">

**Author:** ![Titirez](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/titirez/32/1194668_2.png) [@Titirez](https://forums.unrealengine.com/u/Titirez)\
**Post date:** [December 24, 2016, 4:16pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/2 "2016-12-24T16:16:44Z")

</div>

![119837-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/e/7/6e7ec5b7d26f79fe75f9357dc422248b124b0e67.png)

 ![119838-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/d/c9d08148b3e7b46eba88c5d71e0f00b2e774b17c.png)

 ![119839-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/f/b7f6b455cde7019c16304fa5058cea35489e7880.png)

Add this in the Wheeled vehicle blueprint.

---

<div class="post-metadata">

**Author:** ![CallumFTW](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CallumFTW](https://forums.unrealengine.com/u/CallumFTW)\
**Post date:** [December 25, 2016, 2:03pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/3 "2016-12-25T14:03:41Z")

</div>

Thank you. I’m quite the novice - I am using the advanced vehicle template, what other things do i need to have set up on the wheeled vehicle blueprint to get this code running (e.g. collisions, variables, etc.)

---

<div class="post-metadata">

**Author:** ![Titirez](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/titirez/32/1194668_2.png) [@Titirez](https://forums.unrealengine.com/u/Titirez)\
**Post date:** [December 25, 2016, 2:07pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/4 "2016-12-25T14:07:51Z")

</div>

That should be it. Duplicate the advanced car blueprint (name it AICar or something), in the new car, add that logic, and instead of the target node, place a reference to the car the user is driving. That should make the AICar follow the player car.

---

<div class="post-metadata">

**Author:** ![CallumFTW](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CallumFTW](https://forums.unrealengine.com/u/CallumFTW)\
**Post date:** [December 25, 2016, 2:52pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/5 "2016-12-25T14:52:14Z")

</div>

Not sure if I am referencing right. Made a public actor reference variable and set it to vehicle blueprint which is the default player and the AI vehicle just drives elsewhere :s ?

---

<div class="post-metadata">

**Author:** ![Titirez](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/titirez/32/1194668_2.png) [@Titirez](https://forums.unrealengine.com/u/Titirez)\
**Post date:** [December 25, 2016, 2:59pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/6 "2016-12-25T14:59:28Z")

</div>

When you’re not sure, use logs. The “Log Text” node prints stuff on screen. From the target node you can get “name” and “world location”. Print those on screen and make sure they have the expected values.

---

<div class="post-metadata">

**Author:** ![CallumFTW](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CallumFTW](https://forums.unrealengine.com/u/CallumFTW)\
**Post date:** [December 27, 2016, 1:17am UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/7 "2016-12-27T01:17:07Z")

</div>

Struggling to use the debugging tools. Iv directly referenced the character and it still doesn’t work. Not quite sure what I am missing :s. Need this mechanic as I am making a pursuit game and need to start making assets haha.

 ![119963-capture2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/d/d5d25fe84749c35f286e8ac0548e36aac1c30843.png)

 ![119962-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/0/b30b6768e4921ff608a285d741aed3639b60c896.png)

---

<div class="post-metadata">

**Author:** ![Titirez](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/titirez/32/1194668_2.png) [@Titirez](https://forums.unrealengine.com/u/Titirez)\
**Post date:** [December 27, 2016, 10:57am UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/8 "2016-12-27T10:57:03Z")

</div>

As you can see in the error messages “Accessed None trying to read property Player…”. That means Player is null. That means you have a variable called Player, but it has no value. It does not point to anything. It should point to your player.  
In the left side of capture.png, you have your variables tab and there you have your variable “player”. Press the grey eye icon next to it. This will make it accessible from the details panel in the game viewport. Go there and you should see a drop down where you can select a value for it. Assign the other car (player’s car) in the scene.

---

<div class="post-metadata">

**Author:** ![CallumFTW](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CallumFTW](https://forums.unrealengine.com/u/CallumFTW)\
**Post date:** [December 27, 2016, 9:27pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/9 "2016-12-27T21:27:09Z")

</div>

Managed to get it working by starting game and making my own vehicle rather than modifying the advanced vehicle template. Thank you so much for your help 🙂

---

<div class="post-metadata">

**Author:** ![jjwisniewka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jjwisniewka](https://forums.unrealengine.com/u/jjwisniewka)\
**Post date:** [December 13, 2017, 1:12pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/10 "2017-12-13T13:12:59Z")

</div>

Is the node with . from two vectors2d the same as dot node in UE4.18 ?

---

<div class="post-metadata">

**Author:** ![Imagine-Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imagine-Games](https://forums.unrealengine.com/u/Imagine-Games)\
**Post date:** [July 9, 2019, 6:00am UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/11 "2019-07-09T06:00:59Z")

</div>

\*edit, i used a dot product where the " . " node is (because i still dont know what that . is) and reversed the locations of player character and the vehicle, so i made vehicle location - player location and now it goes to player (whereas before it was going in the exact opposite direction)…

old question: same question as jjwisniewka… wahts that " . " node stand for

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_241040091](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_241040091](https://forums.unrealengine.com/u/anonymous_user_241040091)\
**Post date:** [February 25, 2021, 11:46pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/12 "2021-02-25T23:46:01Z")

</div>

is there any better way now short way please update its 2021 thanks

---

<div class="post-metadata">

**Author:** ![T4D](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@T4D](https://forums.unrealengine.com/u/T4D)\
**Post date:** [April 26, 2022, 11:55pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/13 "2022-04-26T23:55:48Z")

</div>

yeah Lost at the . ?

where the . converts 2 vector2d to the float ?? where do get that ??

---

<div class="post-metadata">

**Author:** ![Kizu123w2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kizu123w2](https://forums.unrealengine.com/u/Kizu123w2)\
**Post date:** [August 17, 2023, 2:22pm UTC](https://forums.unrealengine.com/t/how-can-a-use-blueprint-to-make-vehicle-ai-that-follow-the-player-vehicle/380106/14 "2023-08-17T14:22:30Z")

</div>

dot
