Acceleration/deceleration on characterbody3d

Godot Version



hello what’s the best way to add acceleration/deceleration to a characterbody3d when a specific button is pressed?

Hi, can you provide more information? here is my answer for now:

add an acceleration variable

in the process function you are using to control the character, check if the button is pressed. if it is, use the move_toward function to change the velocity towards a target velocity at the rate of acceleration * delta


thanks I’ve tried

if Input.is_action_just_pressed("up"):
	move_toward(velocity.z, max_speed, acceleration * delta)

and a few variations but cant seem to figure it out

that will only work for one frame after u press up, you need to use is_action_pressed and also you need to assign the result of the move toward function to the velocity

1 Like

sorry what do you mean by this?


1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.