Skip to content
Blog

The anatomy of an Unreal Engine drift: from hop to drift boost

How an Unreal Engine drift works for arcade karts: hop, slip, drift curves and drift boost stages, plus a UE5 drift tutorial for tuning it all in PIE.

Julien Schweter 13 min read
A yellow kart drifting on a desert race track, with blue sparks flying from its rear wheel
On this page

Press the drift button in a kart racer and the kart hops, lands at an angle, slides through the corner while its sparks change color, and shoots out of the exit with a boost. To the player that is one move. To build or tune an Unreal Engine drift like that, you need to see what sits behind it: four phases (hop, slip, drift and post-drift), the way the stick shapes them, and the drift boost on top.

Type “unreal engine drift” into a search box and the suggestions are about cars and Chaos Vehicles. Chaos Vehicles simulate a real car with an engine, gears and tire friction, so faking an arcade drift with them takes a lot of tuning (the comparison post explains why). An Unreal Engine kart drift needs its own model. In this post I take one apart, and at the end you get a tuning routine to follow in Play In Editor (PIE). The examples use the public settings of Kart Racing Drifting Physics, my plugin for Unreal Engine 5, but the ideas work for any kart.

The example kart in a drift: it points into the corner while it slides along the road.

What players expect from an arcade drift

An arcade drift is a trade. The player gives up some control for a moment, and in return gets a fast way through the corner and a reward at the end. The trade feels fair when:

  1. The hop commits. One press picks the side, and the game never has to guess what the player meant.
  2. Speed stays. Holding the throttle keeps the kart moving, so a drift never feels like a brake.
  3. The stick adjusts the line. Pushing into the corner tightens the drift, pushing away widens it, and neither ends it.
  4. Holding the drift pays. The charge is visible, and the release is a kick you can feel.
  5. The exit is clean. The kart comes out pointing down the road, without snapping straight or fishtailing.

When one of these is missing, players rarely say which one. They just say the controls feel off.

The drift as a state machine

In code, a drift is easiest to reason about as a small state machine: each phase has one job, a way in and a way out. The phase names below are the plugin’s settings categories under Kart Base Settings > Drifting.

The phases of an arcade kart driftFrom normal driving, pressing the drift button while steering above the minimum speed starts a hop. Without steering, or when too slow, the press is a plain jump. The hop lands in a slip, the slip fades into the drift, where the boost charges. Releasing the button or dropping below the minimum speed leads to the post-drift phase: the boost of the stage reached fires, grip blends back in and normal driving resumes.DrivingPlain jumpHopSlipDriftPost-driftno steering,or too slowStage 0 and Stage 1Stage 2: SlipStage 3: Drift, two curvesStage 3: Post-Driftnormal grip and turningrotates toward the driftkeeps its old line brieflythe stick sets the linegrip blends back indrift button + steering,above the minimum speedlandsslip fades outbutton released, orbelow the minimum speedboost charges,sparks changeper stageon release:boost of thestage reached

The drift phases with their settings categories. The boost charge runs alongside the drift phase.

The way in

A drift starts when the player presses the drift button while steering and the kart is faster than Minimum Speed Needed for Drift. BP_KartPawn sets it to 1800 cm/s, about half of its 3700 cm/s top speed. The stick at the moment of the hop picks the side, and the kart keeps that side for the whole drift.

A press without steering, or below the minimum speed, is a plain jump. That way the kart never drifts at walking pace, and a hop on a straight stays a hop. The hop itself is set in Stage 0: Pre-Drift (the minimum speed and Jump Height) and Stage 1: Jump (how the kart rotates into the drift).

The slip

After landing, the kart keeps sliding along its old direction for a moment, then blends into the drift. Without the slip it would change direction the instant it touched the ground, and the landing would have no weight. Stage 2: Slip sets how long it lasts.

The way out

The drift ends when the player lets go of the button, or when the kart drops below the minimum speed. That second exit catches people out: a tight line, a wall scrape or a patch of offroad can end the drift halfway through a corner.

How the stick shapes the drift line

During a drift the stick does two jobs, and each has its own curve:

  • Drift Curve: how sideways the kart moves compared to where its nose points.
  • Drift Angular Velocity Curve: how fast the kart rotates, which decides how tight the line is.

Both curves read the stick mirrored for the drift side: 1 is steering into the drift, -1 is steering out of it, and 0 is the stick at rest. So one curve covers left and right drifts, and you see the whole stick range at once.

Drift Curve: how sideways

At 1.0 the drift pushes the kart at roughly 45 degrees to its nose, and higher values make it more sideways. I chose 1.1 because it gives the classic kart racing look. BP_KartPawn keeps it at about 1.1 over the whole stick range, so in the example kart the stick barely changes the slide angle. For karts that lie deeper into the drift, try 1.5 or 2.0.

Curve editor showing FC_DriftVectorScaleByInput: a value of about 1.1 across the whole input range from -1 to 1
The Drift Curve of BP_KartPawn stays at about 1.1, so the slide angle hardly depends on the stick.

Drift Angular Velocity Curve: how tight

In the example kart, this curve does most of the work on the line. It rises from about 0.45 with the stick pushed out of the drift, through 0.75 at rest, to about 1.35 pushed in. Fully in asks for three times as much rotation as fully out, so the same drift can take a hairpin or a long sweeper.

Curve editor showing FC_DriftAngularVelocityByInput: rising from about 0.45 at -1 through 0.75 at 0 to about 1.35 at 1
The Drift Angular Velocity Curve of BP_KartPawn. Left is steering out of the drift, right is steering into it.
How the stick changes the line of a left driftThree paths start at the same point, at the same speed, over the same time. With the stick pushed into the drift, the kart turns in a tight half circle. With the stick at rest, it turns about a quarter circle. With the stick pushed out of the drift, it makes a wide, shallow arc.Left drift, same speed, same time.Only the stick changes.drift startsstick out of the driftcurve about 0.45: widestick at restcurve about 0.75stick into the driftcurve about 1.35: tight

Schematic paths: at the same speed, faster rotation gives a tighter line.

Some rules of thumb for shaping it:

  • Set the middle key first. With the stick at rest, the kart should take the most common corner on your track.
  • Then set the ends: the key at 1 for your tightest hairpin, the key at -1 for your widest sweeper.
  • Keep the slope even. If the curve is steep around 0, small thumb movements swing the line, and that feels twitchy on a gamepad.
  • A keyboard usually sends full left, nothing or full right, so keyboard players mostly get the two ends and the middle. Test with both.

Stage 3: Drift sets how quickly the drift follows a change of the stick; higher values feel snappier. Curve assets are shared by every kart that uses them, so duplicate FC_DriftAngularVelocityByInput before you edit it.

The drift boost: charge, stages and release

While the kart drifts, a charge builds up at the rate of Drift Boost Collection Speed. Each boost stage has a Boost Progress Threshold, and BP_KartPawn has three stages, at 1.5, 3 and 4.5. Below the first one you get sparks but no boost. Let go past a threshold and the kart gets that stage’s boost, through the same Set Boost node that boost pads and items use.

Drift boost charge and stages in BP_KartPawnA bar of charge that fills while the drift is held. Up to 1.5 there are sparks but no boost. From 1.5 the kart is in stage 1, from 3 in stage 2 and from 4.5 in stage 3. Releasing the drift past a threshold fires the boost of that stage.Charge builds while you hold the driftno boostStage 1Stage 2Stage 301.534.5Boost Progress ThresholdLet go past a threshold for that stage's boost.

The three stages of BP_KartPawn. You pick the spark colors; these are the ones from the docs screenshot of the example kart.

Stage fieldWhat it changes
Boost Progress ThresholdCharge needed to reach the stage
Boost Decay SpeedHow fast the boost runs out; higher means shorter
Boost Speed Increase in PercentExtra top speed: 0.2 is +20%
Boost Acceleration Increase in PercentExtra acceleration: 1.0 is +100%
Drift Sparks ColorColor of the sparks at this stage

Three things are worth deciding on purpose:

  • Match the stages to your track. A useful target is that an ordinary corner reaches stage 1, a long sweeper stage 2, and only the longest corners stage 3. If every drift ends in the top stage, the stages stop meaning anything.
  • Decide what charges the boost. By default only drift time counts, not how tight the line is. To reward tight lines, bring the steering input into the charge in the HandleDriftBoost function of BP_KartPawn. That raises the skill ceiling, and it also makes boosts harder for beginners.
  • Decide what happens when boosts overlap, for example a drift boost right after a boost pad. Set Boost has a Reset Boost Progress option, and restarting the timer is usually the right call.

Make every stage readable

The player’s eyes are on the road, so each stage needs feedback they can catch from the corner of their eye. The example kart stacks several kinds:

  • a spark color per stage, from Drift Sparks Color
  • a shockwave particle the moment a new stage is reached
  • exhaust flames while the boost runs
  • its own field of view and camera arm length while boosting (a wider field of view is a common way to make a boost feel faster)

The shockwave moment is also where a sound belongs. A rising tone per stage is easy to learn by ear, and the player never has to look away from the road for it.

The example kart boosting on the desert track, with blue flames from both exhausts and sparks at the rear wheels
Release: exhaust flames tell the player the boost fired.

The camera matters as much as the particles. It should swing into the drift gradually, because a snap at the hop is disorienting, and it should ignore the spring bounce after a landing. The example camera holds its height for a moment after a hop. If the springs keep bouncing, though, even a short landing shake looks endless, so fix Spring Dampening first (Suspension). In multiplayer, play camera shakes and rumble only when Is Locally Controlled is true (Blueprints in multiplayer). Coming in 1.1

The drift itself reads no camera information, so it works the same with a chase, top-down or isometric camera.

Temporal anti-aliasing works against all of this. TSR and TAA blend several frames, which smears the sparks and the slide. The example project sets Anti-Aliasing Method (Project Settings > Rendering > Default Settings) to FXAA.

Coming out of the drift

At the end of a drift the kart is still moving partly sideways. If full grip came back in one step, it would kill that sideways speed at once and jerk the kart straight. If grip comes back too slowly, the kart keeps sliding after the player let go. The plugin blends grip back over a short time, set in Stage 3: Post-Drift.

While a boost is active, a short post-drift correction also nudges and turns the kart toward its direction of travel, so it leaves the corner pointing down the road. Without a boost, the exit is entirely up to the player. To test it, chain a left drift into a right drift through an S-bend and watch the moment between the two.

A step-by-step tuning routine in PIE

If you came for a UE5 drift tutorial, this is the part to follow with the editor open. Start by fixing the physics rate: in Project Settings > Physics > Framerate, check Tick Physics Async and set Async Fixed Time Step Size to 0.016667 (60 Hz). In Config/DefaultEngine.ini that looks like this:

[/Script/Engine.PhysicsSettings]
bTickPhysicsAsync=True
AsyncFixedTimeStepSize=0.016667

Without this you end up tuning for your own PC’s framerate (the async physics post explains why). Then work through these steps in order, because each one builds on the ones before:

  1. Switch to FXAA and tick Print Debug Settings? on the kart so you can read the current speed.
  2. Hop on a straight. Without steering you should get a jump, and with steering above the minimum speed a drift. If the kart bounces after landing, raise Spring Dampening before you touch any drift setting.
  3. Drive a good drift through your tightest corner, read its lowest speed, and set Minimum Speed Needed for Drift below that with some margin.
  4. Shape the line. Fit the key at 0 of the Drift Angular Velocity Curve to your most common corner, then the ends to your tightest hairpin and widest sweeper. After that, compare the Drift Curve at 1.1, 1.5 and 2.0 on one corner.
  5. Tune the entry. Stage 1: Jump decides how the kart turns in during the hop, and Stage 2: Slip how long the slide after landing lasts.
  6. Time the charge with Drift Boost Collection Speed and the thresholds, so your corners end in the stages you planned.
  7. Set the boost strength per stage (the acceleration increase changes how a boosted drift feels a lot), then chain drifts through an S-bend and adjust Stage 3: Post-Drift.
  8. Test with a gamepad and a keyboard, and at a low and a high framerate (t.MaxFPS 30, then t.MaxFPS 144 in the console). With async physics on, the drift should feel the same at both.

Change one value at a time, and drive the same corner a few times before you judge it. The drifting docs list every setting used here.

Common drift tuning mistakes

SymptomLikely causeFix
Pressing drift only hopsNot steering, or slower than the minimum speedSteer while pressing, or lower Minimum Speed Needed for Drift
The drift ends mid-cornerSpeed fell below the minimum (tight line, wall, offroad)Lower the minimum speed, or open up the corner
Hairpins are impossibleKey at 1 of the Drift Angular Velocity Curve too lowRaise it
The kart spins or feels twitchyKey at 1 too high, or the curve steep around 0Lower it, even out the slope
The drift looks like normal steeringDrift Curve too lowTry 1.5, then 2.0
Every drift reaches the top stageThresholds too low for your cornersRaise Boost Progress Threshold or lower Drift Boost Collection Speed
Landings look like screen shakeSprings bounce after the hopMore Spring Dampening
The drift feels different on another PCPhysics tied to the framerateTick Physics Async with a 0.016667 step

For other problems, see the troubleshooting page.

What it takes to build an Unreal Engine drift yourself

Starting from an empty Pawn, you need the parts below, and each one takes longer than it looks:

  • A fixed-rate simulation. If hop impulses, grip forces and drift timers run once per rendered frame, you get a different drift at 30 and at 144 FPS. The async physics tick fixes the rate, but code that runs there needs physics-thread-safe versions of basics like adding a force or reading the velocity.
  • Suspension that holds and lets go. Raycast springs have to keep the kart planted, step aside for the hop and catch the landing without a bounce. When I built the kart, a hard spring handled hills well but launched it off small bumps, which is why there is an option to clamp the spring force.
  • Grip you can switch off. Normal driving needs strong sideways grip and a drift needs close to none. Snapping and fishtailing come from the change between the two.
  • Travel direction separate from facing. In a drift the nose points one way and the kart moves another. Both follow the stick, and both have to mirror cleanly between left and right drifts.
  • Transitions without jolts. Each phase hands speed and rotation to the next one, and any jump in between shows as a twitch. That includes edge cases like a landing on a slope or a wall in the middle of a drift.
  • One boost system for drift boosts, pads and items, with one rule for overlaps.
  • Visuals that follow the physics and never feed back into it. Otherwise the drift depends on the framerate again.
  • For multiplayer, drift state that the client predicts and replays exactly after a server correction. If the body rewinds but the drift timers do not, the replay goes wrong and causes the next correction, so a long drift turns into a chain of them. The post on replicated vehicle physics covers this problem.

Further reading

Skip the hard part

Kart Racing Drifting Physics is the drift from this post, ready to tune: hop, slip, drift and post-drift on a fixed 60 Hz physics tick, the two drift curves, drift boost stages with their own spark colors, Set Boost for pads and items, a camera that locks into drifts, and a rigged kart with Niagara sparks, dust and boost effects. Every setting is in the details panel of BP_KartPawn, so you can tune all of it without writing C++. Multiplayer for Unreal Engine 5.7 is coming as a free update for owners. Coming in 1.1

Drive it first: the free Windows demo runs without Unreal Engine. The drifting docs cover every setting from this post, and the plugin is on Fab.

More from the blog

All articles