Jump to content

[js] detect if mouse do multi circle rotation from a XY point.


jonforum
 Share

Recommended Posts

Would anyone know a method or algorithm in JS to calculate and detect if a mouse is moving by a circle around a target? Example if a rotate mouse *4 time around a specific XY point, i would like to re-center my camera (in my context i need algoritme for a camera engine)

I search i little bit on the web, but no found good formula to perform this.

Maybe a will need a special api ? or easy trick to do this ?
 

in context, the target position are know, i need to find a way to check if the mouse do multiple circled rotation around this target XY, in a timeLaspe (maybe 1000 or 2000 ms)

thank for suggest.
 

Link to comment
Share on other sites

Perhaps think of the space around the target as a square divided into four quadrants with the target at the center? It would be relatively easy to detect when the mouse enters a particular quadrant, so if the mouse enters all four quadrants in order multiple times then it has circled the target multiple times.

Link to comment
Share on other sites

2 hours ago, BobF said:

Perhaps think of the space around the target as a square divided into four quadrants with the target at the center? It would be relatively easy to detect when the mouse enters a particular quadrant, so if the mouse enters all four quadrants in order multiple times then it has circled the target multiple times.

nice idea thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...