Attempting to rotate input direction based on model rotation then camera rotation

Godot Version

4.6.2

Question

I’m writing a 3D character controller, and when the character is in the air I want to rotate the input direction based on model rotation.y to do some velocity calculations, then rotate it based on the camera rotation.y to get the final result.

They always work as expected when done separately (albeit I have to invert the input direction when just rotating by the model rotation if I want it to perfectly line up with my inputs). However when I do them together the result is always misaligned (I can’t figure out the pattern though its not erratic)

func get_movement_input() -> void:
    Pre_Input_Vel = Input.get_vector("move_left", "move_right", "move_forward", "move_back", 0.2)
	Input_Velocity.x = Pre_Input_Vel.x
	Input_Velocity.z = Pre_Input_Vel.y
	Input_Velocity = Input_Velocity.normalized()
	if is_on_floor():
		Input_Velocity = Input_Velocity.rotated(Vector3.UP, spring_arm.global_rotation.y)
func air_movement() -> void:
    	input_velocity_air = input_velocity_air.rotated(Vector3.UP, model.global_rotation.y)
	input_velocity_air = input_velocity_air.rotated(Vector3.UP, spring_arm.global_rotation.y)
	internal_velocity = input_velocity_air

Struggled to find the solution for 2 days then deduce it almost immediately after this gets approved, I just created a new variable and set it to the result of spring_arm.global_rotation.y - model.global_rotation.y. I was just under the impression that by default rotated didn’t work like that, so hopefully this helps others who thought the same.

func air_movement() → void:
``input_velocity_air = input_velocity_air.rotated(Vector3.UP, model.global_rotation.y)
input_velocity_air = input_velocity_air.rotated(Vector3.UP, spring_arm.global_rotation.y)
internal_velocity = input_velocity_air``