smoothness of movement when changing direction (front - back / left - right)

What on earth is going on there in the first script… in line 36 you’re assigning a normalized value to the input direcition, then you’re either assigning the motion inputs (apparently not normalized) or else the existing velocity, normalized… back to the … inputs?!

I cannot even reason about that… It’s Friday.

All I can say is I know that the following BasicFPCC has the important advantage that it Just Works™.

That one has run, walk, jump, slide, crouch… it’s crazy-nutty!!

For smoothing it just relies on the old input system properly set up.

If that’s not settable uppable by you for any reason, here is how to smoothly change values, ANY values:

Smoothing movement between any two particular values:

You have currentQuantity and desiredQuantity.

  • only set desiredQuantity
  • the code always moves currentQuantity towards desiredQuantity
  • read currentQuantity for the smoothed value

Works for floats, Vectors, Colors, Quaternions, anything continuous or lerp-able.

The code: SmoothMovement.cs · GitHub