Gravity works great - steps, that's another issue!

I’m having resolving an aesthetic issue with my 3D gravity calculations for player movement.

I have no problem calculating the effect of gravity on the player:

  • Add a gravity coefficient to a vertical inertia value
  • Test the new ‘feet’ position of the player against the current floor height
  • If the player’s feet go through the floor in the next update, ‘snap’ them to the floor’s height and zero-out the vertical inertia

So far, so good. However, I want the player to be able to walk up onto floor heights that are higher than the current one. Stepping down already works (gravity takes care of that), but at the moment the player will simply ‘snap’ to the higher step height without any form of ‘smoothing’.

I’ve seen many 3D games perform this ‘step’ smoothly - interpolating the player’s vertical position between the lower and higher step point, without the interference of the gravity-vs-floor snapping code.

Does anybody have any suggestions of theory on how to overcome this? Currently the player will snap to the floor-heights without issue - it’s the graduation between the two that is causing me consternation!

Thanks!