🏡Home
Last updated
Last updated
CarAI allows you to add cars that drive independently into your game.
If you want to quickly configure your environment to use CarAI check out the Quick Start guide.
CarAI allows you to create:
Basic traffic
Chase scenes (the car's target is either a waypoint or another car)
Car races, etc...
Cars drive is based on the AI Navigation package and waypoints that you can create to feet the roads of your world.
Each waypoint has a list of connection. Basically the car will choose a first waypoint and then follow each connections when it reach the waypoint.
When there is several possible connections the car choose a connection randomly.
To reached the next waypoint the car use a navmesh surface to get a navpath.
Each of the waypoints contains a traffic light that you can activate or deactivate.
You can choose the maximum speed of each car as well as a braking factor for turns.
Each car contains an obstacle navmesh component (which allows overtaking when the cars do not all have the same speed). This component is automatically activated via a raycast (backward detection distance) and deactivates after a few seconds.
Each car also contains a sensor in which you can set the waypoint detection distance, a backward detection distance (detection of other cars only), enter a particular target (Hunter car concept).
By default, the car stops:
When it encounters another car that does not have the Navmesh Obstacle component activated.
When it encounters a collider whose GameObject is named "StopCollider" (used for traffic lights)
To get started, you can follow the Quick Start guide which will allow you to install CarAI in your Unity project.