Other players spin all the way round when they turn slightly
A character looking just past north and then just past north on the other side should turn a hair, but a plain average of the two numbers sends it spinning the long way round. Angles need their own kind of blending. Here is the rule, the exact tie case, and why one extra step is needed after it.
Why this works
Directions go round in a circle, so ten degrees to the left and the far side of the circle are the same place. Working out the shortest signed turn first, and only then blending, makes a small turn look small whatever numbers it is written with.
When not to use it
Do not take the short way when the long way is the point, such as a wheel, a dial with a stop, or a spinning top where the full number of turns counts. Store a running total of turns, not an angle that wraps.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 17 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Other players spin all the way round when they turn slightly" (read_entry online-turn-the-short-way-around) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP