more tweaks to leaderboard, also changed how gun points during sway

This commit is contained in:
derek
2025-04-09 15:38:14 -05:00
parent 2403fe0f33
commit 92437ea398
11 changed files with 64 additions and 11 deletions

View File

@@ -68,6 +68,7 @@ var gun_is_holstered = false
@onready var level_control = get_tree().current_scene
@onready var interact_ray = $Head/Recoil/Camera3D/InteractRay
@onready var bullet_ray = $Head/Recoil/Camera3D/BulletRay
@onready var gun_look_target: Marker3D = $Head/Recoil/Camera3D/BulletRay/GunLookTarget
@onready var wall_ray_1: RayCast3D = $wall_ray1
@onready var wall_ray_2: RayCast3D = $wall_ray2
@onready var wall_ray_3: RayCast3D = $wall_ray3
@@ -695,12 +696,18 @@ func weapon_tilt(input_x, delta):
camera.rotation.z = lerp(camera.rotation.z, -input_x * HEAD_TILT_AMT, 5 * delta)
func weapon_sway(delta):
#aim gun at center screen
if !gun_ray.is_colliding():
gun.look_at(gun_look_target.global_position)
#apply sway
if !ads:
var joy_input = Vector2(Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)*5,Input.get_joy_axis(0,JOY_AXIS_RIGHT_Y)*5)
mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta)
joy_input = lerp(joy_input,Vector2.ZERO,10 * delta)
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, (mouse_input.y + joy_input.y) * weapon_sway_amount, 5 * delta)
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, (mouse_input.x + joy_input.x) * weapon_sway_amount, 5 * delta)
else:
if gun != null:
if gun.weapon_info.ads == true: