Godot Version
Godot 4.6
Question
Im trying to get 360 degree free aiming working in my game like in the newer metroid games (samus returns and dread). Below is my aiming code which works fine for aiming:
if aiming:
if raw_input and controller:
if snapped(_skin.rotation.y, 0.1) == snapped(PI/2, 0.1):
_spawn_pivot.rotation.x = lerp_angle(_spawn_pivot.rotation.x, atan2(raw_input.y, raw_input.x), 0.5)
elif snapped(_skin.rotation.y, 0.1) == snapped(-PI/2, 0.1):
_spawn_pivot.rotation.x = lerp_angle(_spawn_pivot.rotation.x, atan2(raw_input.y, raw_input.x * -1), 0.5)
if not controller:
var _basis = get_viewport().size/2
var pos = Vector3(-get_viewport().get_mouse_position().x + (_basis.x * 1.01), get_viewport().get_mouse_position().y - (_basis.y * 1.27), position.z)
_spawn_pivot.look_at(pos)
But I need to get the model to aim in the correct direction. My approach was to create 360 different frames for the player aiming at each direction and I was hoping there was a way to cycle between the frames in the code. The rotation of “_spawn_pivot” is the angle the player is aiming at and when converted to degrees, is the frame the player should be on. Is this possible?
below are the frames Im trying to cycle between
