Godot Version
v4.6.2.rc1.official [257ac3532]
Question
In the video, the game (Klonoa Door to Phantomile) is similar to a side-scrolling game, but the character, enemies, and items/objects move in curves and also in straight lines:

This movement continues to limit the character’s movement to only Left, Right, and Jump, and other objects and enemies will also be limited to moving in only these directions.
My question is, should this be achieved in Godot through Path3D?
I imagine that at least for the movement of a CharacterBody3D I should have something like the following code:
extends CharacterBody3D
...
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity += get_gravity() * delta
elif Input.is_action_just_pressed("player_jump"):
velocity.y = JUMP_VELOCITY
var input_dir := Input.get_axis("player_left", "player_right")
var direction := (transform.basis * Vector3(input_dir, 0, 0)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
velocity = get_velocity_from_current_path(velocity)
move_and_slide()
Given that get_velocity_from_current_path(...) is a hypothetical code example, I would probably have to calculate the next location using Path3D and Curve3D:
var local := current_path.to_local(player.global_transform.origin)
var offset := current_path.curve.get_closest_offset(local)
Or should I do it another way?