Class CarAIController
AI controller that drives a car using NavMesh pathfinding. Supports two modes: chasing a player target or following a checkpoint circuit.
Inheritance
object
CarAIController
Namespace: YACC.Controllers
Assembly: .dll
Syntax
public class CarAIController : MonoBehaviour
Remarks
SETUP:
1. Add this component to the same GameObject as CarEngineController
2. Create a child GameObject called "NavProxy" and add a NavMeshAgent to it. The proxy prevents the NavMeshAgent from fighting the Rigidbody for position control.
3. Set navAgent.updatePosition = false and navAgent.updateRotation = false
on the NavMeshAgent — the AI feeds position back manually.
4. Bake a NavMesh on your track/terrain.
5. Assign a target player (ChasePlayer mode) or a list of checkpoint transforms (Checkpoint mode).
Fields
| Name | Description |
|---|---|
| brakeDistance | |
| checkpointReachDistance | |
| checkpoints | |
| lookAheadCorners | |
| maxSpeedKMH | |
| maxSteerAngle | |
| mode | |
| reverseTime | |
| stuckDistanceThreshold | |
| stuckTimeout | |
| targetPlayer | |
| turnSpeedFactor |