If I have an object facing in a direction that needs to turn to match the angle of another object, is there a formula to determine the shortest type of rotation (clockwise vs. counterclockwise)?

This is NOT the same thing as determining the shortest way to turn to FACE another object, which is the formula I ended up creating. I need my object to MATCH the angle of another object.

If you're curious about the facing formula, here it is:

For those who don't understand what the above formula does, it basically draws a line behind the player and then determines which side of that line the target is on. However, the above formula made sense to me because I am able to think of it in cartesian coordinates and not polar ones.

I'm trying to think of a way to determine the shortest way to match the angle of another object, and I can't seem to find a cartesian way to think of it.

In mathematics degrees increased in CCW. But in Construct 2 degrees increased in CW. I wrote the formula thinking in general mathematical way. Simply you can change it like this.

If Target.Angle = 350 and Player.Angle = 10, your formula suggests going clockwise, or 340 degrees. The correct answer is to go counterclockwise 20 degrees.

Sorry if I offended you with my answer Excal, but I tend to try to understand why the question was asked and come up with something simple just in case.

Here is my answer to the question "is there a formula to determine the shortest type of rotation (clockwise vs. counterclockwise)?"

There might be a complex formula for that, but I would do it this way. It's simple to understand and debug. And the function themselves could be used for other stuff in your project.

(also sine and cosine is known to be a slow operation)

Yann, you didn't offend me, I'm just extraordinarily harsh when I get replies that seem to 'probe' and be less related to answering the question.

I think this might actually be a good add to the list of topics on the FAQ, but maybe better worded there because "Shortest rotation angle" can be kind of misleading.