Workshop › OutRun-style Racer › Step 28 of 44
Like a real car, a curve pushes you outwards, and much harder the faster you go: with the speed squared. In gentle curves steering wins easily; in the sharpest ones at top speed the pull is stronger, and you must lift off the gas.
```js
// Steering works better the faster you go; curves push you outwards.
const steer = (keys.ArrowRight ? 1 : 0) - (keys.ArrowLeft ? 1 : 0)
playerX += steer * 0.04 * ratio
playerX -= segmentAt(position + PLAYER_Z).curve * 0.012 * ratio * ratio
```0.012 times ratio squared is subtracted from playerX: a right curve (positive)
pushes you left.Add ; curves push you outwards to the comment, and under the steering line write the pull line.
Skills: Velocity and gravity
← Which segment am I on? Other cars →