I'm working on a top down 2d shooter prototype.
The character should aim at the cursor. I eventually got it to work like this:

I now tried to interpolate in order to get a smoother rotation and also implement some sort of "turn speed" so you can't flick 180° instantly.
I tried RInterpTo and use the current rotation, but it keeps doing weird rotations..
I then tried to just use the Pitch of the current rotation, didn't work either..
I also tried to save the currentAngle in a variable so I could use it for interpolation in the next tick. That did work to some point, but when I rotate over +-180°, the character turns all the way around instead..
The thing is, I don't want to use hit result, I'd like to stick to the mouse's X and Y coordinates. I tried doing that with a vector instead of angles, which I thought would be easier, but I didn't get it to work. I really want it to rotate solely on the Y axis (cuz duh, it's top down 2D..)
Any advice?
Big thanks in advance
The character should aim at the cursor. I eventually got it to work like this:
I now tried to interpolate in order to get a smoother rotation and also implement some sort of "turn speed" so you can't flick 180° instantly.
I tried RInterpTo and use the current rotation, but it keeps doing weird rotations..
I then tried to just use the Pitch of the current rotation, didn't work either..
I also tried to save the currentAngle in a variable so I could use it for interpolation in the next tick. That did work to some point, but when I rotate over +-180°, the character turns all the way around instead..
The thing is, I don't want to use hit result, I'd like to stick to the mouse's X and Y coordinates. I tried doing that with a vector instead of angles, which I thought would be easier, but I didn't get it to work. I really want it to rotate solely on the Y axis (cuz duh, it's top down 2D..)
Any advice?
Big thanks in advance
