Skip to content

Hover racer

For creatorsAdd-on 2.2.2+

In this tutorial you build a hover race: six craft, a 318 m circuit with a dogleg, three laps, and you start at the back of the grid. Scraping the barriers costs energy, two boost pads throw you forward, and the race positions update live. The arcade mover gains grip and a brake, rivals fly a racing line, and the camera rides behind your craft. This builds on tutorial 11, Run-and-gun.

▶ Play the finished game: ← → steer, ↑, W or Space accelerates, ↓ or S brakes, R races again. On a phone: ◀ ▶ ▼ ▲.

The track is a closed loop: a centreline with rounded corners. Everything else follows it.

  1. Save a new file as hover-racer.blend. Model the road along your loop, with curbs along both edges.

  2. Add the barriers along both edges as Arcade Line Wall objects (Add Component ▸ Arcade ▸ Arcade Line Wall) with arcade.wallClosed = 1 and arcade.layer = wall. Tutorial 13 explains these walls in full.

  3. Add the racing line: an Empty named Track.Line with Path, whose path.points are the centreline’s points as x,z pairs in world coordinates, in the direction of travel.

  4. Add eight checkpoints across the road as trigger lines: Arcade Line Wall with arcade.wallSensor = 1 and arcade.layer = check, named Check0 (the start and finish line) to Check7.

  5. Add two boost pads as Arcade Sensor in the layer boost.

The craft is an Arcade Mover steered like the ship in tutorial 2, plus grip and a brake.

Tag Value What it does
arcade.turn · arcade.turnSpeed steer · 125 Steering, in degrees per second
arcade.thrust · arcade.thrustAccel accel · 17 Accelerating
arcade.drag 0.5 With thrust 17, the craft heads for 17 ÷ 0.5 = 34 m/s
arcade.maxSpeed 46 A speed it never exceeds
arcade.grip 5 Speed sideways to the heading bleeds off at 5 per second, so the craft goes where it points. Turn hard and it drifts a moment, then lines up
arcade.brake · arcade.brakeDecel brake · 30 Braking, in m/s²
arcade.collide 1 A barrier stops the craft and it slides along
arcade.radius 0.9 The circle it meets segment walls with
arcade.layer · arcade.hits player · wall,rival Each hit is an event the rules turn into an energy cost
  1. Model the player’s craft, name it Player, and give it Arcade Mover with the tags above.

  2. In World ▸ Simulacrum ▸ Input, add steer = keys:ArrowLeft/KeyA,ArrowRight/KeyD, accel = keys:ArrowUp/KeyW/Space, brake = keys:ArrowDown/KeyS and again = keys:KeyR/Enter, and a pad menu steer@-1=◀|steer@1=▶|brake=▼|accel=▲ shown while playing.

  3. Model five rivals, Rival0 to Rival4, each an Arcade Mover in the layer rival, standing on the grid ahead of the player.

Two more methods help a race. control with 0 locks the player’s steering and thrust (the craft still coasts and collides), and control with 1 frees them: a countdown. heading reads or sets the craft’s heading in degrees, for a respawn that faces down the track.

followPath in loop mode flies a closed path forever, in world coordinates, from the point nearest the craft, a set number of metres to the right of the line (negative is left), facing along it. Its argument is the line’s name, 1, a speed, loop and the lane: Track.Line,1,26,loop,-3.

  1. Add data/rivals.json with one row per rival: its name, its pace in m/s and its lane in metres.

  2. At GO, one For Loop over the table’s rows (a Data Table gives each rival’s name, pace and lane) calls followPath on each rival.

  3. For race positions, ask each rival its progress (laps flown plus the fraction of this one) and compare it with the player’s own progress (laps plus checkpoints passed ÷ 8). Your place is 1 plus the rivals ahead.

pathSpeed changes a rival’s pace on the fly. Rivals fly the line and push nothing; touching one costs the player speed and a little energy. reset also ends a rival’s path, so Race again parks every rival back on its grid slot.

Set the camera in Properties ▸ Scene ▸ Custom Properties:

Tag Value What it does
camera.mode chase The camera rides behind a moving object, in its frame
camera.chase Player The object it rides behind
camera.chaseOffset 0,3.2,8.5 Where it sits in the craft’s frame (forward is −z, so behind is +z)
camera.chaseLook 0,0.6,-12 A point ahead of the craft that it looks at
camera.chaseEase 6 How fast it catches up. A jump of more than 15 m in one frame snaps
camera.fov 70 Its field of view
  1. The countdown. Lock the player with control 0, count down on the HUD, and free it with control 1 at GO.

  2. Checkpoints in order. Crossing the next checkpoint advances nextCheck. Crossing the line (checkpoint 0) counts a lap, and on the last lap it finishes the race. A jump to a later checkpoint counts nothing, so cutting the course gains nothing.

  3. Lap times. Time each lap with the game clock. The best lap is a persistent variable saved for the player.

  4. Energy. −6 for each barrier hit, −3 for each bump with a rival, +1 every second. At 0 the craft is WRECKED.

  5. Boost. On contact with a boost pad, set the craft’s velocity to its forward at its current speed + 12.

  6. The HUD. Lap {lapShown}/3 · P{pos} of 6 · {kmh} km/h · Energy {energy} at the top, the countdown in the centre, and Race again when finished.

  1. Press Build Cartridge, then publish the game (Publish and share).

  2. Open it and hold accelerate at GO: the rivals pull away along the racing line, and a hard turn drifts for a moment before the craft lines up again.

The add-on has no button yet that rounds a polygon into a track or turns a curve into path.points or barrier lines. Type the points yourself (x is Blender’s X, z is minus Blender’s Y), or copy them from your model’s vertices.

  • Grip and a brake turn the arcade mover into a vehicle; control and heading serve a race start and a respawn.
  • followPath in loop mode sends rivals round a racing line, in lanes, with live progress.
  • The chase camera rides behind the craft.

Next: Tracks from real streets races the same game on a loop of real streets.