ended gun clipping forever

This commit is contained in:
derek
2025-01-15 16:59:14 -06:00
parent 93366827fc
commit 63a95ff1da
9 changed files with 799 additions and 178 deletions

View File

@@ -199,6 +199,7 @@ func _physics_process(delta):
if !dead and !level_control.paused:
# Add the gravity.
if is_on_floor():
double_jump = true
@@ -367,8 +368,11 @@ func _physics_process(delta):
# Gun folding out of the way
if gun_ray.is_colliding():
weapon_holder.rotation = lerp(weapon_holder.rotation, Vector3(2, -1, -1), delta * 7)
weapon_holder.position = lerp(weapon_holder.position, Vector3(-.02,-.1,.06),(delta * 7))
var distance_to_wall = 1 - (gun_ray.global_position.distance_to(gun_ray.get_collision_point()) / abs(gun_ray.target_position.z))
var rotation_target = lerp(weapon_holder.rotation, Vector3(2, -1, -1), distance_to_wall)
var position_target = lerp(weapon_holder.position, Vector3(-.02,-.1,.06),distance_to_wall)
weapon_holder.rotation = lerp(weapon_holder.rotation, rotation_target, delta * 7)
weapon_holder.position = lerp(weapon_holder.position, position_target, delta * 7)
gun_folded = true
elif !gun_ray.is_colliding():
weapon_holder.rotation = lerp(weapon_holder.rotation, weapon_holder_start_rot,delta*7)
@@ -526,7 +530,6 @@ func ladder_collide():
else:
gravity = default_gravity
## VARIOUS ACTIONS
func flashlight_toggle():
if flashlight_on:
@@ -540,9 +543,9 @@ func aim_down_sights(delta):
if gun.ads == true:
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
gun.position = lerp(gun.position,ADS_POS,delta * 10 / Engine.time_scale)
else:
gun.position = lerp(gun.position, weapon_start_pos,delta * 2)
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
else:
gun.position = lerp(gun.position, weapon_start_pos,delta * 2)
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
func grab_moveable(body):
holster_gun(true)