A comprehensive 3D UAV (Unmanned Aerial Vehicle) simulation built with React, Three.js, and React Three Fiber. This application provides realistic drone simulation capabilities including surveillance and attack drone modes, complete with terrain interaction, target detection, and anti-drone defense systems.
- Features
- Demo
- Installation
- Usage
- Project Structure
- Architecture
- Components Overview
- State Management
- 3D Models & Assets
- Configuration
- Contributing
- License
- Credits
- Surveillance UAV: Reconnaissance drone for target detection and monitoring
- Attack UAV: Combat drone with missile systems and target lock capabilities
- 🎮 Interactive 3D Environment: Fully navigable 3D terrain with mountains, buildings, and military assets
- 🖱️ Click-to-Move Controls: Intuitive terrain clicking for UAV navigation
- 📹 Multiple Camera Modes: Third-person, first-person, and down-facing camera views
- 🌡️ Thermal Vision: Toggle thermal imaging for enhanced target detection
- 🔋 Battery Management: Realistic battery consumption and monitoring
- 🌤️ Dynamic Weather: Day, night, and rain environment settings
- 💨 Wind Simulation: Random wind gusts affecting flight conditions
- 📋 Mission Planning: Configure mission parameters before deployment
- ⏱️ Timed Missions: Mission duration tracking with automatic completion
- 📊 Mission Results: Comprehensive post-mission statistics and damage assessment
- 🎯 Target Tracking: Real-time target detection and surveillance progress
- 🚀 Missile System: Lock-on targeting and missile launch capabilities
- 💥 Explosion Effects: Realistic explosion and fire effects
- 🎯 Target Lock System: Progressive lock-on mechanics
- 📈 Damage Assessment: Post-strike damage evaluation
- 📡 Anti-Drone Radar: Detection system for incoming UAVs
- 🛡️ Defense Projectiles: Automated missile defense
- 💣 Defense Bombs: Area denial weapons
⚠️ UAV Damage System: Realistic damage modeling and crash mechanics
- 🛡️ Tanks: Armored vehicles with high thermal signatures
- 🚗 Jeeps: Light vehicles with medium detection difficulty
- 🏭 Warehouses: Large structures for surveillance
- 👤 Soldiers: Personnel targets requiring lower altitude detection
- Select "Surveillance" drone type
- Configure mission parameters (duration, targets)
- Click on terrain to spawn UAV
- Navigate to targets by clicking on them
- Hover above targets to complete surveillance
- Return to base before mission time expires
- Select "Attack" drone type
- Deploy UAV at desired location
- Use coordinate controls or click-to-move
- Lock onto targets using the targeting system
- Launch missiles when lock is complete
- Avoid anti-drone defense systems by flying below 20m altitude
- Node.js 18.x or higher
- npm or yarn package manager
- Clone the repository
git clone https://github.com/yourusername/uav-simulation.git
cd uav-simulation- Install dependencies
npm install- Start development server
npm run dev- Open in browser
http://localhost:5173
- Build for Production
npm run build- Preview Production Build
npm run preview| Action | Control |
|---|---|
| Spawn UAV | Click on terrain (first time) |
| Move UAV | Click on terrain (after spawn) |
| Camera Rotation | Click and drag on 3D view |
| Camera Zoom | Mouse scroll wheel |
| Toggle Thermal | Switch in dashboard |
| Change Altitude | Use altitude slider |
- Coordinate Input: Manual X, Y, Z position entry
- Altitude Slider: Adjust flight height (10-50m)
- Thermal Vision Toggle: Enable/disable thermal imaging
- Target List: View detected targets and surveillance progress
- Target Selection: Choose targets for engagement
- Missile Launch: Fire when target lock is complete
- Return to Base: Emergency extraction button
- Health Monitor: Track drone damage status
UAV/
├── public/
│ └── models/ # 3D model assets
│ ├── army_base/ # Military base models
│ ├── building/ # Warehouse/structure models
│ ├── drone/ # UAV model files
│ ├── effects/ # Explosion and visual effects
│ ├── jeep/ # Jeep vehicle models
│ ├── mountain/ # Terrain models
│ ├── soldier/ # Personnel models
│ ├── sounds/ # Audio files
│ ├── surveillance-uav/ # Surveillance drone assets
│ └── tank/ # Tank models
├── src/
│ ├── components/ # React components
│ │ ├── anti-drone/ # Defense system components
│ │ ├── attack-drone/ # Attack drone components
│ │ ├── drone-selector/ # Drone type selection
│ │ ├── mission/ # Mission system components
│ │ └── ... # Other UI components
│ ├── hooks/ # Custom React hooks
│ ├── store/ # Zustand state stores
│ ├── assets/ # Static assets
│ ├── App.jsx # Main application component
│ ├── App.css # Global styles
│ ├── main.jsx # Application entry point
│ └── index.css # Base styles
├── index.html # HTML template
├── package.json # Dependencies and scripts
├── vite.config.js # Vite configuration
└── eslint.config.js # ESLint configuration
| Technology | Purpose |
|---|---|
| React 18 | UI framework |
| Three.js | 3D graphics engine |
| React Three Fiber | React renderer for Three.js |
| @react-three/drei | Useful helpers for R3F |
| Zustand | State management |
| Material-UI | UI component library |
| Vite | Build tool and dev server |
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ User Input │────▶│ Zustand Store │────▶│ 3D Scene │
│ (Click/Keys) │ │ (State Mgmt) │ │ (Three.js) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Dashboard UI │
│ (Material-UI) │
└─────────────────┘
| Component | File | Description |
|---|---|---|
| App | App.jsx |
Main application container |
| Scene | src/components/Scene.jsx |
3D scene setup and rendering |
| UAV | UAV.jsx |
UAV 3D model and rendering |
| UAVController | UAVController.jsx |
UAV movement and physics |
| Terrain | Terrain.jsx |
3D terrain model |
| Component | File | Description |
|---|---|---|
| CommandDashboard | CommandDashboard.jsx |
Surveillance mode controls |
| AttackDashboard | AttackDashboard.jsx |
Attack mode controls |
| BatteryIndicator | BatteryIndicator.jsx |
Battery status display |
| LiveCameraView | LiveCameraView.jsx |
UAV camera feed |
| Component | File | Description |
|---|---|---|
| Tank | Tank.jsx |
Tank target entity |
| Jeep | Jeep.jsx |
Jeep target entity |
| Warehouse | Warehouse.jsx |
Building target |
| Soldier | src/components/Soldier.jsx |
Personnel target |
| Component | File | Description |
|---|---|---|
| AntiDroneSystem | AntiDroneSystem.jsx |
Main defense controller |
| DefenseProjectile | DefenseProjectile.jsx |
Missile projectiles |
| DefenseBomb | DefenseBomb.jsx |
Bomb weapons |
| RadarSweepEffect | RadarSweepEffect.jsx |
Radar visualization |
| Component | File | Description |
|---|---|---|
| AttackUAV | src/components/attack-drone/AttackUAV.jsx |
Attack drone entity |
| MissileSystem | src/components/attack-drone/MissileSystem.jsx |
Missile firing logic |
| TargetLockSystem | src/components/attack-drone/TargetLockSystem.jsx |
Target lock mechanics |
| FireEffect | src/components/attack-drone/FireEffect.jsx |
Fire visual effects |
| CrashedUAV | CrashedUAV.jsx |
Crashed drone debris |
| Component | File | Description |
|---|---|---|
| DayEnvironment | DayEnvironment.jsx |
Daytime lighting/sky |
| NightEnvironment | src/components/NightEnvironment.jsx |
Nighttime settings |
| RainEnvironment | RainEnvironment.jsx |
Rain weather effects |
| Component | File | Description |
|---|---|---|
| MissionPlanningScreen | MissionPlanningScreen.jsx |
Pre-mission setup |
| MissionHUD | src/components/mission/MissionHUD.jsx |
In-mission display |
| MissionResultsScreen | src/components/mission/MissionResultsScreen.jsx |
Post-mission stats |
The application uses Zustand for state management with multiple specialized stores:
{
position: [x, y, z], // Current UAV position
rotation: [rx, ry, rz], // UAV rotation
targetPosition: [x, y, z], // Movement target
isThermalVision: boolean, // Thermal mode toggle
isCrashed: boolean, // Crash state
battery: number, // Battery percentage
droneType: string, // 'surveillance' | 'attack'
targets: [], // Detected targets
}{
missionStatus: string, // 'planning' | 'active' | 'completed'
missionParameters: {}, // Mission configuration
missionTimeRemaining: number,
completedObjectives: [],
}{
droneHealth: number, // Health percentage
targeting: {}, // Lock-on state
destroyedTargets: [], // Eliminated targets
missiles: [], // Active missiles
}{
cameraMode: string, // 'third-person' | 'first-person' | 'down-facing'
cameraSettings: {}, // Per-mode configurations
}{
detectedTargets: [], // Currently visible targets
completedTargets: {}, // Surveilled targets count
}{
isClickToMoveEnabled: boolean,
clickIndicator: {}, // Visual feedback position
spawnIndicator: {}, // Spawn location marker
}{
environment: string, // 'day' | 'night' | 'rain'
windSpeed: number,
visibility: number,
}All 3D models are licensed under CC-BY-4.0 and sourced from Sketchfab:
| Model | Author | Source |
|---|---|---|
| UAV | Artem Goyko | Sketchfab |
| Terrain | Pukar Shiwakoti | Sketchfab |
| Tank | See license.txt | public/models/tank/ |
| Jeep | See license.txt | public/models/jeep/ |
| Building | See license.txt | public/models/building/ |
Sound effects are located in public/models/sounds/:
explosion.mp3- Explosion sound effectsexplo.mp3- Missile launch sounds
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
})// UAVController.jsx
const HOVER_HEIGHT = 15; // Default hover altitude
const WIND_GUST_MIN_INTERVAL = 10; // Min seconds between gusts
const WIND_GUST_MAX_INTERVAL = 30; // Max seconds between gusts// AntiDroneSystem.jsx
const RADAR_RADIUS = 50; // Detection range
const MIN_SAFE_ALTITUDE = 20; // Below this = stealth mode// Warehouse.jsx, Tank.jsx, etc.
const SCAN_RADIUS = 20; // Target detection rangeThis project is licensed under the MIT License - see the LICENSE file for details.
The 3D models used in this project are licensed under CC-BY-4.0. Please see individual license files in the public/models/ directories for attribution requirements.