How to achieve smooth slope sliding in 3D?

Godot Version

4.2.1

Question

To try out the code just paste it into a _physics_process() of a characterbody3d and put it on top of a rotated csgbox.

	if not is_on_floor():
		velocity.y -= gravity * delta

	var normal = Vector3.ZERO

	if is_on_floor():
		normal = get_floor_normal()

	normal.y = -normal.y

	velocity += normal * 0.4
	
	move_and_slide()

Using this code, I want my player to accelerate down a slope. Currently they slide fine but after reaching a certain speed they start to “bounce”.

The player isn’t really bouncing but once they start going too fast they overshoot the ramp and then gravity has to catch up to bring the player back down, whilst I just want the player to stick to the ground the whole way.

Any advice on how to fix this? Or alternative ways to achieve this effect?

maybe setting a terminal velocity related to the normal