Tag Info

New answers tagged

1

I love the other answers given. Very technical! If you want, I have a very simple method to accomplish this. We'll assume angles for these examples. The concept can be extrapolated to other value types, such as colors. double MAX_ANGLE = 360.0; double startAngle = 300.0; double endAngle = 15.0; double distanceForward = 0.0; // Clockwise double ...


4

The trick is to remember that angles (at least in Euclidean space) are periodic by 2*pi. If the difference between the current angle and the target angle is too large (i.e. the cursor has crossed the boundary), just adjust the current angle by adding or subtracting 2*pi accordingly. In this case, you can try the following: (I've never programmed in ...


6

It’s not always the best method, and it can be more computationally expensive (though this ultimately depends on how you store your data), but I will make the argument that lerping 2D values works reasonably well in the majority of cases. Instead of lerping a desired angle, you can lerp the desired normalised direction vector. One advantage of this method ...



Top 50 recent answers are included