Hello.
Help is needed.
2D game. In the picture, you see the blueprint code of the smooth rotation of the object (airplane) behind the mouse.
The problem is that, for example, 85 degrees and -250 degrees are visually near, but if the object is at 85 degrees and I’m aiming at -250, then the object rotates not along the shortest path, but along the whole axis.
Maybe you can put a branch somewhere in between to check if difference between current rotation and target rotation is more than 180 or less than -180, and if it is, change the interpolation speed to -1?
How to connect?
This is control in the Controller, and the controller is assigned to the character. Everything is as usual.
Even if you create a new project, you create an empty character and enter this logic to it - nothing happens.
Here is the project itself.
Who is not difficult - can download and see.
I do not understand how to fix this. I’ll be picking myself for now. https://dropmefiles.com/yRtaG
Use your original code you posted but after the atan2 operation check if the absoulte value is greater than 180. If so, subtract it from 360 and multiply the difference by -1