SkeletonIK3D changes the player character's pose in a weird way

Godot Version

Godot Engine v4.2.1.stable.official

Question

Hi all! I’m pretty new to Godot (and 3D in general), so apologies if there is an obvious answer to the question - just haven’t been able to figure it out myself.

I’m developing a 3rd person game, and most recently I’ve been trying to get the player character to look up/down following the mouse cursor when they’re carrying a weapon so that the gun points to the aiming reticle in the middle of the screen. I’m using a mixamo rig and mixamo animations, but I’ve made and rigged the character model in Blender and then exported to Godot.

I added a SkeletonIK3D node to the character, and then added a Marker3D node as the target. This works in principle, the character looks up and down following the mouse as intended, but the problem I’m having is that whenever the IK is active, it rotates the bones of the character in a weird way so that the barrel of the gun no longer points to the center of the screen, but somewhere up and to the left.

I made a short video clip to demonstrate what happens: https://youtu.be/IqJk_nIxD9M

How do I get this unwanted rotation to stop from happening? I’ve racked my brain for days now and the only thing I can do to get it to work is manually offset the y-rotation of the target node by exactly -29 degrees, bringing it back to the center but this feels like a hack and it doesn’t help with the upwards rotation…

Any help sincerely and truly appreciated!