Workshop › OutRun-style Racer › Step 26 of 44
In a curve the road jumps a little each time the camera enters a new segment, because the bending always starts from
the segment under the camera. Starting dx at a fraction of that segment's curve, how far through it we are, makes it
smooth.
```js
let dx = -segments[base % segments.length].curve * ((position % SEG) / SEG)
```position % SEG is how far into the current segment the camera is (0 to 199); divided by SEG it is 0 to 1.dx at minus that fraction of the curve moves the bend back smoothly while we cross the segment.Change let dx = 0 to the new line.
Skills: Velocity and gravity
← Bend the road Which segment am I on? →