Java Robot class simulating human mouse movement

后端 未结 3 898
离开以前
离开以前 2021-02-08 17:58

I am working on a project about remote control, send conrdinate x and y of cursor from client to server.

But

robot.mouseMove(x,y);

wi

3条回答
  •  别跟我提以往
    2021-02-08 18:38

    There are a few things to consider if you want to make the artificial movement natural, I think:

    1. Human mouse movement is usually in a slight arc because the mouse hand pivots around the wrist. Also that arc is more pronounced for horizontal movements than vertical.
    2. Humans tend to go in the general direction, often overshoot the target and then go back to the actual target.
    3. Initial speed towards the target is quite fast (hence the aforementioned overshoot) and then a bit slower for precise targeting. However, if the cursor is close to the target initially the quick move towards it doesn't happen (and neither does the overshoot).

    This is a bit complex to formulate in algorithms, though.

提交回复
热议问题