A sophisticated AI-powered vehicle control system for Unity, featuring intelligent pathfinding, obstacle avoidance, and advanced vehicle maneuvering capabilities.
vv.webm
- Dynamic Path Following: Intelligent navigation to target destinations
- Speed Control: Adaptive speed based on road conditions and situations
- Wheel Physics: Realistic wheel physics and vehicle movement
- Obstacle Detection: Multi-directional obstacle detection and avoidance
- Smart Overtaking: Intelligent obstacle avoidance and overtaking system
- Dynamic U-Turns: Automated U-turn execution when target is behind
- Reverse System: Advanced reverse maneuvering in tight spaces
- Stuck Detection: Automatic detection and recovery from stuck situations
- Realistic Wheel System: Complete wheel physics with suspension
- Anti-Stuck System: Prevents vehicles from getting stuck on obstacles
- Terrain Adaptation: Adjusts to different terrain conditions
- Smooth Controls: Natural and realistic vehicle movement
- Clone this repository to your Unity project:
git clone https://github.com/AminHasanloo/Unity-AI-Vehicle-System.git- Import the following scripts into your Unity project:
AIVehicleController.csVehicleController.csVehicleObstacleAvoidance.csVehicleReverseSystem.csVehiclesAntiStuckSystem.cs
- Create a vehicle GameObject in your scene
- Add the required components:
- Rigidbody - Wheel Colliders - AIVehicleController - VehicleObstacleAvoidance - VehicleReverseSystem - Configure the wheel settings in the inspector:
- Set up wheel transforms
- Configure wheel colliders
- Adjust physics parameters
[Header("AI Navigation")]
public float detectionRange = 50f;
public float obstacleDetectionRange = 20f;
public float sideDetectionRange = 8f;
[Header("Speed Settings")]
public float normalSpeed = 100f;
public float boostSpeed = 150f;
public float corneringSpeed = 70f;[Header("Reverse Detection")]
public float stuckCheckDuration = 2f;
public float minimumSpeedThreshold = 2f;
public float obstacleCheckDistance = 1.5f;
[Header("Turn Around Settings")]
public float quickTurnThreshold = 5f;
public float turnInPlaceForce = 800f;- Add a target object to your scene
- Assign the target to the AI Vehicle Controller
- Configure the layers for obstacle detection
- Adjust the parameters to match your vehicle's characteristics
// Example: Setting up the AI destination
aiVehicleController.destination = targetTransform;The system automatically calculates the optimal path to the target while avoiding obstacles:
- Checks for clearance before making turns
- Determines the best overtaking direction
- Adjusts speed based on path complexity
Handles complex situations where the vehicle needs to reverse:
- Detects when reverse is necessary
- Calculates safe reverse distance
- Manages multi-point turns
Automatically adjusts vehicle speed based on:
- Distance to target
- Upcoming turns
- Obstacle proximity
- Terrain conditions
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.
- Unity Technologies for the amazing physics system
- The Unity community for valuable feedback and suggestions
- All contributors who helped improve this system
- Amin Hasanloo - [hsoamin76@gmail.com]
- Linkedin -[https://www.linkedin.com/in/amin-hasanloo-b0974716b/]
- TELEGRAM - [https://t.me/tilitpro]
Made with โค๏ธ for the Unity Community

