Dev Log: Drift Works
Been at this for months. Tonight I finally got drift working in UE5 Chaos. Not "kind of slides if you squint," I mean the car commits to a slide and you have to fight it back. Bullitt feel. Wanted to write down what actually got me there because almost everything I tried before didn't.
The big lesson: pure physics-based drift in Chaos doesn't work. I spent weeks tuning lateral slip curves, cornering stiffness, friction multipliers, all of it. The Chaos tire model just produces near-zero longitudinal force at high slip ratios. Rear wheels spin visibly, car loses all momentum, slide dies. I tested it, confirmed it, then stopped fighting it. You have to force-feed torque and modulate grip via blueprint. That's the secret. Hybrid sim plus arcade.
What ended up working:
The drift state is gated. Press handbrake at speed greater than 25 mph AND with steering input above 0.3 absolute AND not already drifting AND not in a burnout. All four conditions have to be true. If you press handbrake going straight, you just get a normal handbrake. If you press it while turning at speed, the car commits.
Drift entry sets bIsDrifting to true, drops all four wheel slip graph multipliers (0.4 on fronts, 0.1 on rears), boosts max engine torque from 750 to 500 (yes, lower torque actually felt better than higher, counterintuitive), and activates Niagara skid VFX on the rear tires.
The car maintains the drift on its own from there. The handbrake button is the trigger, not the sustain. Player has to manage angle and throttle to stay in the slide.
Drift exits when any of three conditions hit on Event Tick: speed drops below 25 mph, drift angle drops below MinDriftAngle (player straightened out), or drift angle exceeds MaxDriftAngle (spun out). The angle math was the bug that cost me hours. You compute it as Acos of the Dot Product of normalized forward vector and normalized velocity vector, then take the absolute value. Skip the Acos and you're comparing cosines, not degrees, and your gates will never fire correctly. Add a velocity length check too, because normalizing near-zero velocity produces garbage.
Body movement was its own rabbit hole. I had the suspension tuned soft as hell, damping at 0.15, low rollbar, lower spring rate, all of it. Car still drove like it was bolted to a plank. Turns out the issue wasn't suspension at all. It was the moment arm between Center of Mass and where suspension forces apply. With COM at Z = -15 and Suspension Force Offset at Z = -20, the forces were pushing through the mass instead of around it. No lever, no rotation.
Fix was three settings. Suspension Force Offset Z back to 0. Center of Mass Z up to +10 (above the axles, not below). Inertia Tensor Scale down to 0.5 across the board. Suddenly the car dives under braking, squats on launch, leans into corners. Looks alive.
Other lessons from this stretch:
Change one thing at a time when tuning. Multiple changes mask which one actually did the work.
Use showdebug vehicle and the console p.Vehicle.ShowCOM commands. Don't tune blind.
Get the architecture right before you tune values. I tried to skip ahead to "feels right" before the underlying state machine was correct, and it cost me. Once the entry/exit/state logic was solid, dialing values was fast.
The biggest win wasn't a technical one. It was choosing to stop fighting the Chaos tire model and embrace a hybrid approach. Pride was costing me weeks. Once I accepted that "force-feeding torque" wasn't cheating, things moved.
Tomorrow I start on the actual game. AI car that runs from the player on a spline, basic chase scenario, see how the drift feels in real driving instead of an empty plane. Vertical slice goal hasn't changed. The car serves the chase.