Seems to mostly work

This commit is contained in:
derek
2024-10-02 15:39:40 -05:00
parent 3121e9d4d2
commit 70a6a23604
10 changed files with 24 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
extends Node3D
var recoil_amount : Vector3 = Vector3(.1,0,0)
var snap_amount : float = 8
var snap_amount : float = 10
var speed : float = 4
var current_rotation : Vector3
var target_rotation : Vector3
@@ -17,6 +17,9 @@ func _process(delta: float) -> void:
current_rotation = lerp(current_rotation, target_rotation, snap_amount * delta)
basis = Quaternion.from_euler(current_rotation)
func add_recoil() -> void:
print("ADD RECOIL")
target_rotation += Vector3(.1,0,0)
func add_recoil(recoil_amount) -> void:
var recoil_x = recoil_amount.x
var recoil_y = randf_range(-recoil_amount.y,recoil_amount.y)
var recoil_z = randf_range(-recoil_amount.z,recoil_amount.z)
target_rotation += Vector3(recoil_x, recoil_y, recoil_z)