A 3D flying game built with Unity 6.0 LTS featuring smooth flight controls and browser-compatible WebGL deployment.
- Smooth Flight Controls - Intuitive WASD movement with Q/E turning
- 3D Flight Physics - Forward/backward and strafe movement in 3D space
- Browser Compatible - WebGL build ready for web deployment
- Beginner Friendly - Clean, well-commented code for learning
- Open Source - MIT licensed for modification and learning
| Key | Action |
|---|---|
| W | Move Forward |
| S | Move Backward |
| A | Strafe Left |
| D | Strafe Right |
| Q | Turn Left |
| E | Turn Right |
WebGL build will be hosted online for instant play
-
Prerequisites:
- Unity 6.0 LTS or newer
- Git installed on your system
-
Clone and Run:
git clone https://github.com/affigabmag/unity-flying-game.git cd unity-flying-game -
Open in Unity:
- Open Unity Hub
- Click "Add project from disk"
- Select the
unity-flying-gamefolder - Click "Open"
-
Play:
- Press the Play button (
▶️ ) in Unity Editor - Use WASD + Q/E keys to fly around
- Press the Play button (
- Unity 6.0 LTS (6000.0.54f1)
- Universal Render Pipeline (URP)
- C# Scripting
- Visual Studio 2022
Assets/
├── PlayerController.cs # Main flight control script
├── Scenes/
│ └── SampleScene.unity # Main game scene
└── Settings/ # URP and project settings
ProjectSettings/ # Unity project configuration
Packages/ # Package dependencies
The main script handling flight mechanics:
- Movement System - Transform-based movement for smooth flight
- Input Handling - WASD for movement, Q/E for turning
- Speed Control - Configurable speed and rotation parameters
- Player Object - Capsule collider with visual indicator cube
- Camera - Standard third-person follow setup
- Lighting - Directional light for basic scene illumination
Edit values in PlayerController.cs:
public float speed = 10f; // Movement speed
public float rotationSpeed = 500f; // Turning speedThe codebase is designed for easy expansion:
- Add terrain and obstacles
- Implement speed boosts
- Create "around the world" mechanics
- Add UI/HUD elements
- Include sound effects
-
Switch Platform:
- File → Build Settings
- Select "WebGL"
- Click "Switch Platform"
-
Build:
- Click "Build"
- Choose output folder
- Wait for compilation
-
Deploy:
- Upload generated files to web server
- Ensure server supports WebGL compression (.br files)
- Static File Server (nginx, apache, or simple HTTP server)
- MIME Type Support for .br, .js, .wasm files
- HTTPS recommended for full compatibility
- OS: Windows 10/11, macOS, or Linux
- Unity: 6.0 LTS or newer
- RAM: 4GB minimum, 8GB recommended
- Storage: 2GB for Unity + project files
- Browser: Chrome, Firefox, Safari, Edge (recent versions)
- WebGL Support enabled
- JavaScript enabled
Contributions are welcome! Here's how to help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Add new flight mechanics (barrel rolls, speed boosts)
- Create terrain and world environments
- Implement UI/menu systems
- Add sound effects and music
- Create mobile touch controls
- Optimize performance