Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Thanks! It's actually simpler than it looks. Instead of thinking about tracking the mouse's movement direction, track the angle of the cursor around the center of the screen.

Every frame I do three things:

  1. Find the cursor's position relative to screen center;  that gives me a little arrow pointing from the middle of the screen out to the cursor.
  2. Measure that arrow's angle (one atan2; in Godot it's just offset.angle()).
  3. Compare it to last frame's angle. The difference is how far you swept around the center this frame; the sign of that difference tells me clockwise vs. counter-clockwise.

I tried to understand how Osu did it and apply it as best I could for my use case.

No gesture recognition, no recording the path, just "what angle is the cursor at, and how fast is that angle changing."

Thank you for playing and good luck with the voting!

(+1)

Ohh yes that is clever! Thanks for taking the time to explain