5 func should_enter(input) -> String:
6 input.actions.sort_custom(moves_priority_sort)
7 return input.actions[0]
10 func update(input: InputPacket, delta: float):
11 # Get the XZ input direction based on player's input relative to the camera
12 var forward := camera.global_basis.z
13 var right := camera.global_basis.x
14 var move_direction := (
15 forward * input.movement_direction.y + right * input.movement_direction.x
19 # if we're not stuck, then it's okay to set the velocity
20 var floor_normal = player.get_floor_normal()
21 var ground_slope_input = (PI / 2) - player.velocity.angle_to(floor_normal)
22 player.velocity = player.velocity.move_toward(
23 move_direction * (player.walk_speed + ground_slope_input * player.walk_speed),
24 player.acceleration * delta
27 player.move_and_slide()