Xbox Keyboard Mouse Adapter Using Arduino

Hi there

The way I see it is that you move on the square and not the circle.

You need to calculate the lengh of the vector from (0,0) to (x_move,y_move). If the lengh is < 4095 you are inside the circle and you have no problem - just move.

  1. If lengh is > 4095 you are outside the circle and you have a problem.
    2a)Convert x_move and y_move til abs values.
    2b) Calculate the angle between your abs vector and x-axis (0,4095).
    2c) Calculate the intersect cordinats with the circal - this can be done since you know both the angle and the radius of your circle (4095). This is your new x_move and y_move.
    2d) Apply correct signs (+/-) to new x_move and y_move based on the original x_move and y_move - check the 4 quardrants.
    2e) Move.

-Fletcher

Thank for helping :slight_smile:

But this is not my problem :frowning: if you move the mouse diagonally it seen faster than up, down, left, and right. We need to clamp the value inside the circle not chop it off i'm not good at math so i need some help here :frowning: