Basically I just have no idea how to implement acceleration and deceleration, and furthermore, when the player accels and decels it should treat the slope so you would glide with acceleration up the slope the same distance as you would down the slope. This would work well with my current system of moving up and down slopes at the same speed.
Thanks in advance for the help!
This is my current system, but it seems very bad.
if Input.is_action_pressed("move_forward"):
velocity.x -= sin(rotation.y) * acceleration
velocity.z -= cos(rotation.y) * acceleration
if Input.is_action_pressed("move_left"):
velocity.x -= cos(rotation.y) * acceleration
velocity.z += sin(rotation.y) * acceleration
if Input.is_action_pressed("move_backward"):
velocity.x += sin(rotation.y) * acceleration
velocity.z += cos(rotation.y) * acceleration
if Input.is_action_pressed("move_right"):
velocity.x += cos(rotation.y) * acceleration
velocity.z -= sin(rotation.y) * acceleration
if velocity.x != 0 || velocity.z != 0:
if is_on_floor(): #friction!
velocity.z *= 0.9;
velocity.x *= 0.9;
if abs(velocity.x) <= 0.0001:
velocity.x = 0;
if abs(velocity.z) <= 0.0001:
velocity.z = 0;