tweaked bullet and pick up method

This commit is contained in:
Derek
2024-11-04 23:04:56 -06:00
parent 818b25417a
commit 3002c6e2db
9 changed files with 40 additions and 19 deletions

View File

@@ -3,7 +3,7 @@ extends CharacterBody3D
const WALK_TRANSITION_SPEED = 8
const MAX_AIR_DASH = 1
const FLASHLIGHT_BRIGHTNESS = 30
const KICK_AMOUNT = 10
const KICK_AMOUNT = 20
const LAND_CAMERA_TILT : Vector3 = Vector3(-1,0,0)
const WALK_SPEED = 12.0
const SPRINT_SPEED = 15.0
@@ -45,9 +45,6 @@ var start_sensitivity
@export var BASE_FOV : float = 80
@export var FOV_CHANGE = 1.5
#@export_group("Gun") DELETE IF DOESNT CAUSE ISSUES
#@export
var gun : Node
@onready var dead_player : Resource = load("res://assets/dead_cam.tscn")
@onready var pause_menu: Control = $Head/Recoil/Camera3D/PauseMenu
@@ -111,6 +108,7 @@ var pickupmsg
@onready var weapon_pickup_audio: AudioStreamPlayer = $Audio/WeaponPickup
@onready var crt_filter: ColorRect = $Head/Recoil/Camera3D/crtFilter
@onready var moveable_holder: Node3D = $Head/MoveableHolder
@onready var stand_check: RayCast3D = $StandCheck
func _ready():
@@ -335,13 +333,15 @@ func _physics_process(delta):
if held_item != null:
var held_force_dir = moveable_holder.global_position - held_item.global_position
held_item.set_constant_force(held_force_dir * 30)
held_item.rotation = lerp(held_item.rotation, held_item_rotation, delta)
print("HELD ITEM ROTATION " + str(rad_to_deg(held_item_rotation.y)))
held_item.rotation = held_item_rotation #lerp(held_item.rotation, held_item_rotation, delta * 30)
#break when moved too far away
var distance_from_player = abs(self.global_position - held_item.global_position)
if distance_from_player.length() > 5:
release_moveable()
if stand_check.is_colliding():
if stand_check.get_collider() == held_item:
release_moveable()
#interact button
if Input.is_action_just_pressed("interact"):
@@ -360,7 +360,7 @@ func _physics_process(delta):
if interact_ray.is_colliding():
if interact_ray.get_collider().is_in_group("scene_rigidbody"):
kick_audio.play()
interact_ray.get_collider().linear_velocity += transform.basis * Vector3(0,0,-KICK_AMOUNT)
interact_ray.get_collider().linear_velocity += transform.basis * Vector3(0,0, -KICK_AMOUNT)
if held_item != null:
release_moveable()
@@ -451,7 +451,6 @@ func grab_moveable(body):
held_item_angular_damp_cache = body.angular_damp
held_item_gravity_cache = body.gravity_scale
held_item_mass_cache = body.mass
#change rigidbody settings
body.linear_damp = 5
body.angular_damp = 5