I am currently trying to use slerp but godot complains about it not being a normalized vector, the error is exactly this (setaxisangle: The axis Vector3 must be normalized)
I tried adding normalize to everything it complains, nothing changes.
code down below:
extends Spatial
var current_rotation = Vector3()
var target_rotation = Vector3()
export (float) var recoil_X
export (float) var recoil_Y
export (float) var recoil_Z
export (float) var snappiness
export (float) var return_speed
func _physics_process(delta):
target_rotation = lerp(target_rotation,Vector3.ZERO,return_speed * delta)
current_rotation = current_rotation.slerp(target_rotation,snappiness * delta)
if Input.is_action_just_pressed("B"):
print(current_rotation)
set_rotation_degrees(target_rotation) # I think this sets the rotation
func recoil_fire():
target_rotation += Vector3(recoil_X,rand_range(-recoil_Y,recoil_Y),rand_range(-recoil_Z,recoil_Z))
print(target_rotation)