more collision tweaks and fixed gun folding

This commit is contained in:
derek
2024-09-26 16:37:54 -05:00
parent 79600825f5
commit 2d49d4e31f
12 changed files with 227 additions and 207 deletions

View File

@@ -96,7 +96,7 @@ func shoot(delta):
if player.gun_folded == false:
instance_bullet.transform.basis = player.bullet_ray.global_transform.basis
else:
instance_bullet.transform.basis = barrel_raycast.global_transform.basis
instance_bullet.transform.basis = barrel_raycast.global_transform.basis
instance_bullet.bullet_speed = bullet_speed
instance_bullet.player_velocity = player.velocity
instance_bullet.bullet_drop = bullet_drop

View File

@@ -234,8 +234,7 @@ func _physics_process(delta):
gun.cycle_count = gun.cycle_count_start
# Gun folding out of the way
if gun_ray.is_colliding() and !gun_ray.get_collider().is_in_group("player"):
#check distance to wall later ?
if gun_ray.is_colliding():
gun.rotation = lerp(gun.rotation, Vector3(1, -1, -.25), delta * 10)
gun.position = lerp(gun.position, Vector3(gun.start_position.x-.15,gun.start_position.y +.2,gun.start_position.z +.6),(delta*10))
gun_folded = true