From 606fb98afc36ab48c9dccff11bbdcabd9fda082c Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Thu, 27 Feb 2025 04:23:32 -0500 Subject: [PATCH] variable waterpole spinning --- objects/canny_cat.gd | 7 +++++-- objects/canny_cat.tscn | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/objects/canny_cat.gd b/objects/canny_cat.gd index ee9c3d5..304340b 100644 --- a/objects/canny_cat.gd +++ b/objects/canny_cat.gd @@ -168,13 +168,15 @@ var _pole_stored_speed: float = 0.0 func _start_pole_spin() -> void: _pole_stored_speed = flatten_vector(velocity).length() velocity = Vector3.ZERO + floor_snap_length = 0.0 var pole_xz = flatten_vector(_attached_pole.global_position) var self_xz = flatten_vector(global_position) _pole_angle = Vector3.FORWARD.angle_to(self_xz - pole_xz) func _process_pole_spin(delta: float) -> void: + var speed_factor = inverse_lerp(0.0, power_scale, _pole_stored_speed) # rise - global_position.y += _attached_pole.rise_speed * delta + global_position.y += lerpf(0.0, _attached_pole.rise_speed, speed_factor) * delta global_position.y = clampf( global_position.y, _attached_pole.global_position.y, @@ -182,7 +184,7 @@ func _process_pole_spin(delta: float) -> void: ) # spin - _pole_angle += _attached_pole.spin_speed * delta + _pole_angle += lerpf(0.0, _attached_pole.spin_speed, speed_factor) * delta var pole_xz = flatten_vector(_attached_pole.global_position) var self_dir = Vector3.FORWARD.rotated(Vector3.UP, _pole_angle) var self_xz = pole_xz + self_dir * _attached_pole.offset @@ -194,6 +196,7 @@ func _end_pole_spin() -> void: var impulse = Vector3.FORWARD.rotated(Vector3.UP, _pole_angle) * _pole_stored_speed velocity.x = impulse.x velocity.z = impulse.z + floor_snap_length = 0.1 #endregion diff --git a/objects/canny_cat.tscn b/objects/canny_cat.tscn index 019bfee..f65f169 100644 --- a/objects/canny_cat.tscn +++ b/objects/canny_cat.tscn @@ -213,9 +213,9 @@ delay_in_seconds = "0.0" [connection signal="charge_canceled" from="." to="Sounds/ChargeCancel" method="play"] [connection signal="shot" from="." to="Sounds/Shoot" method="play"] [connection signal="state_physics_processing" from="StateChart/Root/Idle" to="." method="_apply_gravity"] -[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_bounce_on_walls"] -[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_slow_to_stop"] [connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_apply_gravity"] +[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_slow_to_stop"] +[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_bounce_on_walls"] [connection signal="state_entered" from="StateChart/Root/Charging" to="." method="_start_charge"] [connection signal="state_entered" from="StateChart/Root/Charging" to="Sounds/ChargeStart" method="play"] [connection signal="state_exited" from="StateChart/Root/Charging" to="." method="_end_charge"]