fix: correct axis direction, air accel, and jump/dash input handling
This commit is contained in:
@@ -50,11 +50,11 @@ func _process(_delta: float) -> void:
|
||||
var sm := _ensure_machine()
|
||||
if not sm:
|
||||
return
|
||||
sm.input_jump_just_pressed = Input.is_action_just_pressed("jump") and not sm.input_jump_pressed
|
||||
sm.input_jump_just_pressed = Input.is_action_just_pressed("jump")
|
||||
sm.input_jump_pressed = Input.is_action_pressed("jump")
|
||||
sm.input_sprint = Input.is_action_pressed("sprint")
|
||||
sm.input_crouch = Input.is_action_pressed("crouch")
|
||||
sm.input_dash = Input.is_action_just_pressed("dash") and not sm.input_dash
|
||||
sm.input_dash = Input.is_action_just_pressed("dash")
|
||||
sm.input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
|
||||
# DEBUG: emit every frame so we can see whether inputs reach the controller.
|
||||
|
||||
@@ -22,7 +22,7 @@ func update(delta: float) -> void:
|
||||
|
||||
# Input direction
|
||||
var input_v := machine.input_dir
|
||||
var wish_dir := Vector3(input_v.x, 0.0, -input_v.y)
|
||||
var wish_dir := Vector3(input_v.x, 0.0, input_v.y)
|
||||
if wish_dir.length_squared() > 1.0:
|
||||
wish_dir = wish_dir.normalized()
|
||||
|
||||
@@ -31,7 +31,7 @@ func update(delta: float) -> void:
|
||||
var hvel := Vector3(vel.x, 0.0, vel.z)
|
||||
var target_vel := wish_dir * effective_speed * params.air_control
|
||||
|
||||
hvel = hvel.lerp(Vector3(hvel.x + target_vel.x, 0.0, hvel.z + target_vel.z), 1.0 - exp(-params.air_acceleration * delta))
|
||||
hvel = hvel.lerp(target_vel, 1.0 - exp(-params.air_acceleration * delta))
|
||||
|
||||
vel.x = hvel.x
|
||||
vel.z = hvel.z
|
||||
|
||||
@@ -19,7 +19,7 @@ func update(delta: float) -> void:
|
||||
|
||||
# Input direction
|
||||
var input_v := machine.input_dir
|
||||
var wish_dir := Vector3(input_v.x, 0.0, -input_v.y)
|
||||
var wish_dir := Vector3(input_v.x, 0.0, input_v.y)
|
||||
if wish_dir.length_squared() > 1.0:
|
||||
wish_dir = wish_dir.normalized()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user