jump ani fixing and transition animations
This commit is contained in:
@@ -52,11 +52,8 @@ func update(delta: float) -> void:
|
||||
# ── Horizontal movement (exponential interpolation for smoothness) ───
|
||||
var hvel := Vector3(vel.x, 0.0, vel.z)
|
||||
var target_vel := wish_dir * effective_speed
|
||||
|
||||
if wish_dir.length_squared() > 0.0:
|
||||
hvel = hvel.lerp(target_vel, 1.0 - exp(-params.ground_acceleration * delta))
|
||||
else:
|
||||
hvel = hvel.lerp(Vector3.ZERO, 1.0 - exp(-params.ground_deceleration * delta))
|
||||
hvel = _next_horizontal_velocity(
|
||||
hvel, target_vel, wish_dir.length_squared() > 0.0, delta)
|
||||
|
||||
vel.x = hvel.x
|
||||
vel.z = hvel.z
|
||||
@@ -127,6 +124,14 @@ func update(delta: float) -> void:
|
||||
return
|
||||
|
||||
|
||||
func _next_horizontal_velocity(current: Vector3, target: Vector3,
|
||||
has_input: bool, delta: float) -> Vector3:
|
||||
var response := params.ground_acceleration \
|
||||
if has_input else params.ground_deceleration
|
||||
return current.lerp(target if has_input else Vector3.ZERO,
|
||||
1.0 - exp(-response * delta))
|
||||
|
||||
|
||||
func _try_step_up(player: CharacterBody3D, wish_dir: Vector3, hvel: Vector3) -> void:
|
||||
for i in range(player.get_slide_collision_count()):
|
||||
var col = player.get_slide_collision(i)
|
||||
|
||||
Reference in New Issue
Block a user