Moving Smoothly on X axis

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Help Me

Hello,
I’m trying to wall jump in a 2d platformer. I’d like for the character to move horizontally when they jump off the wall (i.e. diagonally). The character moves vertically smoothly and perfectly, but horizontally they “skip” and instantaneously jump from their current location to the new horizontal location. Thoughts?

if nextToRightWall() and !is_on_floor() and Input.is_action_just_pressed("jump" + action_suffix):
	return Vector2(100, -500)
elif nextToLeftWall() and !is_on_floor() and Input.is_action_just_pressed("jump" + action_suffix):
	return Vector2(100, -500)
else:
	velocity.x = speed.x * direction.x
:bust_in_silhouette: Reply From: jGames20

I am no expert (I am new to Godot and GDScript), but could lerp (I believe linear interpolation) work?

See: @GDScript — Godot Engine (stable) documentation in English

If not then maybe Quat SLERP (spherical linear interpolation)?

Also what about multiplying by deltaTime (I believe in Godot it’s just delta)?