Join our Discord server to meet other Rookies!
Programming AI - Cars

Programming AI - Cars

Juan Antonio Vizcaino Merino
by ToniVizcaino on 17 Jan 2023

Simple AI car routines using the NavMeshAgent, with Raycast to slow down the cars before possible collision of them. the car model is not mine, it belongs to my friend and classmate Carlos Vicente Pastor.

2 60 0
Round of applause for our sponsors

This AI system is configured thanks to Unity's nav mesh.

The routes are randomised once the car is instantiated. Previously these routes are saved in a list through a script and the cars always have a reference of the possible routes.

the junction is the only one where the two lanes coexist.

Script for the vehicle

Script for a Checkpoint GameObject

Raycast Script

We have two lanes and cars always drive on the right, so at every crossing they have to change the area where they can go and where they cannot go.

List of routes (Inspector Unity)

Component NavMeshAgent of the Car (Inspector)

Comments (0)

This project doesn't have any comments yet.