🚗
Playable Vehicle AI
🚗
Playable Vehicle AI
  • 🏡Home
  • ⭐Quick Start
  • 🚗Create cars
  • ↗️Waypoints
  • 🔀Waypoint Groups
  • ➕Spawn / Unspawn
  • 🚦Traffic Light
  • 🛑Priority Stop
  • 🚓Police
  • 👨‍🦱Player / Car Manager
  • 💥Integrations
  • 🆙Use in your code
  • Support
  • Discord
Powered by GitBook
On this page
  • 1 - Import Playable Vehicle AI package
  • 2 - Dependencies
  • 3 - Layer & Navmesh

Quick Start

Last updated 4 months ago

1 - Import Playable Vehicle AI package

Import the Playable Vehicle AI package from the Unity Package Manager, just like any other package (download & import)

Once the package is imported, you should see a new folder called Simon's Asset in your Asset folder. It contains the Playable Vehicle AI folder with all the resources you need to make it work.

Here is a view of the tree structure of the package:

2 - Dependencies

If you enconter an error like:

The type or namespace name 'EVP' could not be found (are you missing a using directive or an assembly reference?)

Please Install EVP.

To install com.unity.ai.navigation in the Package Manager click on Unity Registery and search for "com.unity.ai.navigation". Then install de package.

3 - Layer & Navmesh

In order for cars to find their way across your terrain, Playable Vehicle AI needs a navmesh surface. I will guide you in images to create this navmesh surface in a few very simple steps.

1 - Create an empty GameObject and name it NavMeshSurface (or something explicit that you will find easily)

2 - Add the NavMeshSurface component on this new GameObject

3 - In the NavmeshSurface component you will have to fill a agent type, adefault area and bake it based on a layer that will be attached to you roads GameObjects

4 - Click on the Agent Type select then on Open Agent Settings...

5 - This should open the Navigation window. In the Navigation window, create a new Agent Type by clicking on the + button

6 - Name this new Agent Type "Car" or something you will be able to retrieve easily.

7 - Then click on the Area button

8 - Create a new Area by giving a name to the first one that is free. (here it is the Area for cars so I call it Car)

9 - Go back to the Navmesh Surface component and set Agent on "Car" and the Default Area on "Car"

10 - Then, the last step is to set your roads objects on a dedicated layer. To do that, in the Layer select click on "Add Layer..."

11 - Add a "Roads" (or any name that you preffer) layer

12 - Select the parent GameObject of every roads objects in your scene and set the Layer on the one you've just created

13 - Unity will ask if you want to set the layer for all child objects. Click "Yes".

14 - Finally in the "Object Collection" > "Include Layers" field select your layer and click on "Bake".

15 - Once the baking process is done, you should be able to see your Car Navmesh Area when you select your Navmesh Surface object.

That's it... Your Navmesh is ready. But you will have to create some waypoints to allow your car to navigate.

For now Playable Vehicle AI needs to work.

Playable Vehicle AI also need the Unity packages to work.

com.unity.ai.navigation is essential. It's used to generate a navmesh surface and calculate the path between each waypoints. See the section

To do that, you can go to the page

⭐
⚠️
Edy's Vehicle Physics
com.unity.ai.navigation
Layer & Navmesh
Waypoint