gun movement and swing tweaks

This commit is contained in:
Derek
2024-08-03 15:55:03 -05:00
parent 4d4685eea0
commit 2296eb8605
2 changed files with 4 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ dead_player = ExtResource("2_4hoys")
SENSITIVITY = 0.008
BOB_AMP = 0.085
weapon_holder = NodePath("Head/Camera3D/WeaponHolder")
weapon_sway_amount = 0.5
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
visible = false

View File

@@ -303,12 +303,12 @@ func _on_pick_up_magnet_body_entered(body):
func weapon_tilt(input_x, delta):
if weapon_holder:
weapon_holder.rotation.z = lerp(weapon_holder.rotation.z, -input_x * weapon_rotation_amount * 10, 10 * delta)
weapon_holder.rotation.z = lerp(weapon_holder.rotation.z, -input_x * weapon_rotation_amount * 10, 4 * delta)
func weapon_sway(delta):
mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta)
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, mouse_input.y * weapon_rotation_amount, 5 * delta)
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, mouse_input.x * weapon_rotation_amount, 5 * delta)
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, mouse_input.y * weapon_sway_amount, 10 * delta)
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, mouse_input.x * weapon_sway_amount, 10 * delta)
func weapon_bob(vel : float, delta):
if weapon_holder: