2D Character rotation problem (gimbal lock?)

I’ve set up a linetrace that works. (only the color doesn’t change should be green but it stays red)
I know that it works because I tested it with print strings.

245443-char-on-wall.jpg

When the fly character hits the wall I want to rotate it 90deg:

Everything I’ve tried didn’t work out. I’ve read that this could be something called gimbal lock.
I’ve tried looking up “gimbal lock” but it seem very complicated. Most of what I found was for 3D making it even more complicated. Like:

I don’t even know if this is a gimbal lock problem, I’ve tried many different rotations and all of them showed the same result: the sprite not rotating.

It’s not exactly what I was looking for but I found something usable:

I used SetActorRotation to get the sprite rotated, now I just need to get the walking part working.