Skip to content
← All projects
TOOLUnityphysicstutorialInput System

A drone engine in Unity

A flight engine born for a helicopter in 2012, turned into the Arcade Copter demo, then a drone that rotates exactly like the real one, live and in tutorials on the channel.

droneOne is the third life of a flight engine I have been evolving since 2012. Each time, the same question: what does a flying machine look like in Unity when you want it to fly like a real one?

From a helicopter to a drone

It all started with a contract for Jimmy Fischer and his company Studio 3WG (around 2012-2013): he needed a Unity script to fly a helicopter in an Android game.

In 2015, we decided to build a demo of that engine with Arcade Copter: a futuristic helicopter-drone in a dark world lit by lava. The graphics are by Stéphane Landry (3D modelling, textures and level design). The game never shipped: it really was a side project, even though we could probably have made something of it.

A few years later, in 2019, I was looking for what to show in my YouTube series to prove what you can build in a few minutes with Unity. The drone engine builds on what I had already shown about the 3D physics engine, and made two episodes of A toi de coder. That is this project, droneOne, restarted from scratch in August 2019.

The engine

At its heart is a DroneController on a rigidbody, and a DroneConfiguration that gathers every setting: power, rotation speed, tilt limits. The visual model is split from the physical object, so you can swap drones without touching the behaviour.

A few milestones from the history:

  • the early ArcadeCopter is renamed DroneEngine, with a first jet-powered model;
  • the rotation matches the physical drone exactly (September 2019);
  • each axis has its own smoothing, and rotation can be clamped to zero on any axis (pitch, yaw, roll!);
  • a custom inspector draws the rigidbody velocity arrow in the scene, the same technique as in LaForce.

From prototype to game: the infinite runner

During a live stream, the prototype became an infinite runner: a track built from chunks using Kenney’s assets, a distance counter, collectables and jets that move with the power. A new drone inspired by the Swordfish arrived (I am a big Blake and Mortimer fan) with its own configuration, and the pitch power was tuned specifically for the runner.

In October 2019, the project moved to Unity’s new Input System to handle several control types (keyboard and touch) and adopted the four scenes template.

The videos

The toy trap

Every time I pick this project up again, I spend as much time playing with the drone or the helicopter as developing it. That is probably what makes it relevant, the fun of flying is there from the very first minutes, and it may also be what kept me from turning it into a real product, in the business sense.