We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I've partly borrowed some code that creates a 'clock' by splitting 360 degrees around the center of the screen into 12 steps. While the circle does 'jump' between steps, the 'jumping' behaviour doesn't work the way it is supposed to. The problem is that the circle will only jump forward by one step, if the angle of the mouse is >= the angle of the step, and it jumps backwards a step as soon as the mouse angle goes below the angle of the step.
I've through various different methods tried (and failed) to create an effective method to make the stepping circle jump to the step which angle is closest to the angle of the mouse, so that it would jump step 1 when the angle was greater than 15 degrees and less than 45.
Any ideas?
(Also: I am for some reason completely unable to format the code into the forum(???) so i've uploaded it to github): github.com/xtxte/RebelScum/blob/master/sketch_170325b.pde
Answers
for your code, please follow these instructions:
https://forum.processing.org/two/discussion/32/how-to-format-text-and-code-on-the-new-forum
to format the code, edit your post, highlight the code, press ctrl-o.
i must've written those words 100000 times.
anyway, your code:
I know exactly what you mean and have an idea for how to solve it that I know works as I'we done it years ago, but it wasn't in processing or even for mouse,
actually it was for a xbox 360 controller, and 8 steps rather than 12,
but the principle should be the same, you check the "change of rotation" in steps and add it to the clock, rather than direct the clock towards the mouse.
Something like this..
You need a special case for when it goes from 12 to 1 and vice versa
Also having 36 mouse steps and 12 clock steps would help
solution to this was to use round() instead of int() when mapping the angles