My Humble Boomer Shooter: Smooth movement part 2

Channel:
Subscribers:
316
Published on ● Video Link: https://www.youtube.com/watch?v=btYmtUcxKwA



Duration: 7:58
56 views
3


EDIT: THIS BREAKS JUMPING! It has to be:
if direction:
velocity.x = lerp(velocity.x, direction.x * SPEED, ACCELERATION * delta)
velocity.z = lerp(velocity.z, direction.z * SPEED, ACCELERATION * delta)
else:
velocity = velocity.move_toward(Vector3(0, velocity.y, 0), DECELERATION * delta)
* The "* delta" isn't absolutely necessary but with it you can use simpler variables as ACCELERATION and DECELERATION
** Original before editing **
if direction:
velocity = velocity.lerp(direction * SPEED, ACCELERATION * delta)
else:
velocity = velocity.move_toward(Vector3(0, 0, 0), DECELERATION)