# How to use Vehicles AI

The Vehicle AI is very similar to the enemy AI in operation, it also uses Waypoint Path and calculates paths through NavMesh. The Vehicle AI can be used on any vehicle in the JUTPS Vehicle class.

There's no secret, just add the Vehicle AI script to your vehicle and configure the variables.

<figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2FZTd1uFKDrjqA18Tcntyb%2FVehicle%20AI%20Low%20Quality%20Gif.gif?alt=media&#x26;token=138957b2-d3b9-4a68-90e8-907238e09bdf" alt=""><figcaption><p>Vehicle being controlled completely by AI</p></figcaption></figure>

See the parameters to configure below

| Vehicle AI Parameters                                             | Description                                                                                              |
| ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| Enable Pathfinding                                                | Enable NavMesh Pathfinding                                                                               |
| Recalculate Path Refresh Rate                                     | Time to recalculate path                                                                                 |
| Destination                                                       | Destination                                                                                              |
| Waypoint Path                                                     | Waypoint Path                                                                                            |
| Distance to Continue Path                                         | Distance to go to next waypoint/path index                                                               |
| Vehicle Desaceleration Intensity                                  | Deceleration in curves                                                                                   |
| Front Check                                                       | Front sensor                                                                                             |
| Check Nearest Point On Path                                       | Checks the nearest point on the waypoint/path and prevents the AI from going back to a previous Waypoint |
| On End Path \[ Stop, Reverse, Restart ]                           | What the vehicle will do after finishing the path                                                        |
| On Start Path \[<mark style="color:blue;">Unity Event</mark>]     | Event called when AI start path                                                                          |
| On Following Path \[<mark style="color:blue;">Unity Event</mark>] | Event called when AI walk along the path                                                                 |
| On Ended \[<mark style="color:blue;">Unity Event</mark>]          | Event called when AI reaches the end                                                                     |
