Weird camera issue, characterbody3d is rotating around y axis

Godot Version

4.2.1

Question

Hi there,

I’ve got a weird issue that is kind of hard to explain. My 3D player script is pretty basic and uses a clamp function at 90 and -90 degrees to ensure the player can’t look too high or low, pretty normal stuff.

However if I collide with any object by standing on top of it or jumping into a wall or something when looking all the way up the character will rotate around itself on the y axis and what it seems to ignore the clamp.

I’m sure that’s not the case but im just not sure what’s happening exactly.

I would imagine this has come up before but I can’t seem to find anything online. If someone could help me pinpoint the issue I’d be very thankful.

I’ve attached a video of what im talking about after i jumped into a wall, all im doing is moving the mouse up and down,

heres my character controller script -