AI cars drive on waypoint routes, which are modular and can be interconnected to create any type of path.
There are multiple types of AI car prefabs listed below, use these as a base to create your own AI car prefab variants.
|AI_Car_DriverLeft||Avatar driver is configured on the left side of the car. All car options and effects are enabled.|
|AI_Car_DriverRight||Avatar driver is configured on the right side of the car. All car options and effects are enabled.|
|AI_Car_OptimizedTraffic||Minimal rig with only the required components to make the car drive.|
This AI car prefab can be used for many purposes, it has an array of volume sensors to detect the surroundings and make decisions based on configured route options. If you’re an experienced C# Unity programmer, you can read this data and use the available vehicle variables and control overrides to create custom behaviors.
- Creating traffic simulations with intersections and lights, that can be timed and sequenced.
- AI opponents for racing.
- Custom AI enemies, allies or other for scripted gameplay events and sequences.
- Most other reasons you might need a highly customizable AI car.
Car AI Settings
A ScriptableObject used as a profile for AI cars, adjust these settings to change the rules for an AI vehicle while it’s driving.
|Use Waypoint Distance Threshold||Use distance threshold check to determine when the next waypoint is reached.|
|Waypoint Distance Threshold||The distance required for “use distance threshold check” to determine when the next waypoint is reached.|
|Use Waypoint Reset||The AI vehicle will be moved to the current waypoint if it does not reach it before the waypoint reset time.|
|Use Stuck Reset||If stopped, the AI vehicle will be moved to the current waypoint if it’s not move before the stuck reset time.|
|Waypoint Reset||Amount of time since reaching the last waypoint that it will take before the AI vehicle is moved to the current waypoint when Use Waypoint Reset is enabled.|
|Stuck Reset||Amount of time the AI vehicle needs to be stuck for before it will be will be moved to the current waypoint.|
|Change Lane Cooldown||The amount of time required after changing lanes until the AI vehicle can change lanes again.|
|Change Lane Distance||The distance threshold an obstacle needs to be in front of the AI vehicle to trigger a lane change check, if the vehicle can turn left or right and the next waypoint contains a junction in that direction the AI will merge into one of the available routes.|
|Auto Caution Distance Threshold||Automatically apply caution if forward sensor is triggered.|
|Caution Slow Speed||The rate at which caution is additivily applied when using “Auto Caution Distance Threshold”.|
|Input Sensitivity Steering||A factor to increase or decrease the amount of steering toward a target angle that is processed.|
|Input Sensitivity Acceleration||A factor to increase or decrease the amount of acceleration that is processed.|
|Input Sensitivity Brake||A factor to increase or decrease the amount of brake that is processed.|
|Enable Sensors||Enable or disables the AI vehicle sensors (sensors are required to change lanes).|
|Update Interval||Sensor update interval, increase if you don’t need sensors to be updated every frame.|
|Detection Layers||Layer Mask used by sensors, only assigned layers will be detected.|
|Sensor Height||Sets the height for all sensors.|
|Sensor F Center Width||Sets the width for the forward center sensors.|
|Sensor F Side Width||Sets the width for the forward side sensors.|
|Sensor LR Width||Sets the width for the left and right side sensors.|
|Sensor F Center Length||Sets the length for the front center sensors.|
|Sensor F Side Length||Sets the length for the front side sensors.|
|Sensor LR Length||Sets the length for the left and right side sensors.|