Hey @dragonforge-dev thank you again for the response. These were all reasonable options and I had to see what made sense for my game. Really all of them do, but I settled on solution #3.
I believe this logic is good enough (please correct me if I am wrong):
func _physics_process(delta):
handle_player_movement(delta)
func _unhandled_input(event):
if event is InputEventJoypadMotion:
movement_direction = Input.get_vector("left_gamepad_left",
"left_gamepad_right",
"left_gamepad_forward",
"left_gamepad_backward")
rotation_direction = Input.get_vector("right_gamepad_left",
"right_gamepad_right",
"right_gamepad_forward",
"right_gamepad_backward")
if event.is_action_pressed("shoot", true):
shooting_triggered = true
if event.is_action_released("shoot"):
shooting_triggered = false
func shoot():
shooting_component.handle_weapon_input()
func handle_player_movement(delta):
if shooting_triggered:
shoot()
var player_direction = (transform.basis * delta * Vector3(movement_direction.x, 0, movement_direction.y)).normalized()
var player_rotation = (transform.basis * delta * Vector3(rotation_direction.x, 0, rotation_direction.y)).normalized()
if player_direction:
velocity.x = player_direction.x * player_speed
velocity.z = player_direction.z * player_speed
else:
velocity.x = 0.0
velocity.z = 0.0
if player_rotation != Vector3.ZERO:
player_mesh.basis = Basis.looking_at(player_rotation)
player_mesh.basis.orthonormalized()
move_and_slide()
If anyone else comes across this, this thread was also useful: unhandled_input is not handling some input
I definitely overthought this, though. It was good to go back over the docs.
Apologies for the late reply, my wife and I adopted a puppy shortly after my original post and I am just getting back into my side project. Thanks again!