Flying, the FPV kind
Want your game to fly like a drone with goggles on? This page shows exactly how J'aime Voler does it, with the real code from the game: a flight model small enough to drop into your own game, two ways to fly it, and the whole source free to take. Start in Level mode. Everyone does.
Try it: J'aime Voler
One island, thirteen glowing gates, and a ghost of your best lap to chase. Click inside the game, then fly with WASD (throttle and yaw) and the arrow keys (pitch and roll). Space boosts, Shift is precision. This exact game is the code this whole guide is about.

Open the game full screenRead the full sourceDownload the game
Two ways to fly: start with Level
Level mode
The sticks tilt, the craft follows. Push a stick and the craft banks to a set angle and turns. Let go and it levels itself and holds its altitude. You steer where it points; the model handles the rest. Forgiving, calm, and the right first flight model for almost every game and almost every player.
Acro mode
The sticks spin. Hold a stick and the craft keeps rotating at a set rate, flips and rolls included. Center the stick and it holds whatever angle it is at, even upside down. This is how real FPV drones fly, and it is a handful until it clicks. Offer it as the expert option: in Voler one key (X) swaps modes, so pilots graduate when they are ready.
Both modes share everything else: the same throttle, the same thrust, the same camera. In the code it is one settings flag, and the physics function branches exactly once. That is the whole trick of this guide: build Level first, then add Acro as a second branch.
How the flight model works
- One state, four inputs. The craft is a position, a velocity and an orientation. The pilot is four numbers from -1 to 1: throttle, yaw, pitch, roll, plus boost and precision switches. Everything else is math on those, run once per frame.
- Level mode turns sticks into angles. The stick picks a target bank and pitch (38 degrees at most on the Chill profile), and the craft eases toward it. Release the stick and the target is flat and level, so the craft settles on its own. Yaw just turns the heading at a capped rate.
- Acro mode turns sticks into spin rates. The same sticks now command degrees per second around each axis. The curve that shapes them is one small function: gentle near the center of the stick, fierce at the edges. Three profiles (Chill, Sport, Insane) retune the whole craft without touching code.
- Thrust points where the nose points, and hover is a fraction. Throttle maps onto the thrust-to-weight ratio, so a centered stick is exactly hover in both modes. Push up and the craft accelerates along its own up axis, which is why banking turns you. In Level mode the thrust is corrected for tilt, so turns hold their altitude instead of sliding down.
- The camera is the craft, tilted up. FPV view puts the camera right at the craft and pitches it up by the uptilt (25 degrees in Voler). That tilt is the secret: at speed the craft pitches down to move, so a level camera would stare at the ground. The chase view is the same craft from behind, smoothed. Either way, the field of view widens a little as speed builds, which sells the speed for free.
The rules that keep it friendly
- Start in Level mode. Most players, and most games, never need more. Acro is a graduation, not a starting point.
- Tune with profiles, not code. One small table changes how the whole craft feels. Ship Chill first.
- Hover is a fraction, not a guess. Because throttle maps onto the thrust-to-weight ratio, centered means hover in both modes, on every profile.
- Uptilt is not optional at speed. 20 to 30 degrees keeps the horizon and the next gate in view.
- Crash kindly. Voler pauses for two seconds and respawns you at the last gate. New pilots keep flying instead of quitting.
Grab the code
J'aime Voler, the whole game
One HTML file, about 82 KB: the flight model, both modes, the island, the gates, ghost laps and the scoreboard hook. The friendliest place to start is the real thing.
Read itDownloadThe flight model, extracted
Just the flying: state, inputs, both modes, thrust, and the camera, pulled out of the game into one commented file (fly-core.js) that drops into any three.js project. This is the file to hand a builder who already has a game.
Read itDownloadHow multiplayer works
Flying is better with company. The sister guide shows how our games do pop-in multiplayer, with the full code from E2 Pong and E2 World 2D.
Read the multiplayer guideBuild yours
- Drop fly-core.js into your three.js project, or start from the whole Voler file.
- Feed it inputs: WASD and the arrow keys are the friendly default.
- Start in Level mode on the Chill profile, with a ground height function for your world.
- Put the camera at the craft with about 25 degrees of uptilt.
- Add Acro as the second branch when Level feels solid, and upload your game here.
Upload your gamePlay J'aime VolerHow multiplayer works
Use this code in your own games however you like. A shout-out is nice, never required.