# Quick Start

### 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:

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FwnRHaNZndNuA01uYvY7d%2Ffiles-tree-structure.jpg?alt=media&#x26;token=997de406-ea2a-4d2e-97e4-0ce90ad98697" alt=""><figcaption></figcaption></figure>

### 2 - Dependencies

:warning: For now **Playable Vehicle AI** needs [**Edy's Vehicle Physics**](https://assetstore.unity.com/packages/tools/physics/edy-s-vehicle-physics-403) to work.

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**.

**Playable Vehicle AI** also need the [**com.unity.ai.navigation**](https://docs.unity3d.com/Packages/com.unity.ai.navigation@2.0/manual/) 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 [Layer & Navmesh](#id-3-layer-and-navmesh) section

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)

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FjmQoCPmCqWMtLOMx26v3%2F1-create-empty-object.png?alt=media&#x26;token=2fd7708d-80df-425d-8204-7f15c3c0c668" alt=""><figcaption></figcaption></figure>

#### 2 - Add the NavMeshSurface component on this new GameObject

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FaC9dtGq6fzOwcfFTcGLA%2F2-add-navmesh-surface-component.png?alt=media&#x26;token=4bc9b3f4-197d-44b4-b50d-e018bd7c4894" alt=""><figcaption></figcaption></figure>

#### 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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FEBiNwRPRLJuDQW5zZOwU%2F3-navmesh-surface.png?alt=media&#x26;token=c24fe30d-8ccb-4888-990f-b349160d8448" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FctZLVRyYUbIgN9AoisBj%2F4-agent-settings.png?alt=media&#x26;token=9dfebed4-c01f-448c-81ba-a8eea30b7fee" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FZgqxsmhyJbRP5DFftjQ6%2F5-add-agent-type.png?alt=media&#x26;token=73ee1e63-8a13-429a-b296-feed66b2b019" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FbDeHlAnWNSU0EAhYYdFz%2F6-car-agent-type.png?alt=media&#x26;token=06648167-1c2d-41e4-a8b0-23b242aba742" alt=""><figcaption></figcaption></figure>

#### 7 - Then click on the Area button

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FPyHOwEu5AbUxzS3oraWK%2F6-click-area.png?alt=media&#x26;token=c85ef490-3826-412e-b06f-5d86bc9ac737" alt=""><figcaption></figcaption></figure>

#### 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)

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FXOE57xXrN7NvBXiogv0Z%2F7-add-car-area.png?alt=media&#x26;token=14e069d1-2be3-41ef-9d75-d357419305d1" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FCAcZySa9wNXG0uuMcCe2%2F9-navmesh-type-and-area.png?alt=media&#x26;token=01e5a4c9-549b-43a6-a936-0e0e07de4287" alt=""><figcaption></figcaption></figure>

#### 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..."

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FwoI2fsLVqKHzfe9OeOdq%2F10-add-layer.png?alt=media&#x26;token=670aff57-43cd-4d28-8bff-0d7fc31f0aea" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FGv184FElav8M3nGvQrBE%2F8-add-roads-layer.png?alt=media&#x26;token=d7d45129-63a7-4bc8-83d7-cea91baa8764" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FPjr2HOWyf61L8i1iVVcx%2F11-set-road-layer-an-all-road-objects.png?alt=media&#x26;token=130d1264-7048-4922-b309-69db770e0c22" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FpwXcy6ryAdchedZi8KDO%2F12-apply-to-all-childs.png?alt=media&#x26;token=58a0caef-e083-4543-83e6-0056678daba2" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FSDEt6SE1Nl4iuKVWTfGz%2F13-roads.png?alt=media&#x26;token=18e78907-adfc-4dc1-b308-0e74f424c360" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2610139454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MP8g62RDn4oRKfNbmqL%2Fuploads%2FCxLgiRxb8kpZO8UWH6Gm%2F14-baked-roads-navmesh.png?alt=media&#x26;token=10ca3029-8cea-4c6f-9b4d-660df19fa034" alt=""><figcaption></figcaption></figure>

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

To do that, you can go to the [Waypoint ](https://simons-assets.gitbook.io/playable-vehicle-ai-documentation/waypoints)page
