Python Forum

Full Version: how to make the movement humanized
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
this code makes the mouse move using mouse_event for certain angles, but the movement is very robotic, I would like to make the movement humanized, how can I do that?
weapons = [
        {
            "name":"XSW",
            "rpm":600,
            "magazine": 30,
            "img_name":"t_ak.png",
            "img": None,
            "x":1,
            "y":1,
            "pattern":[ (0,0),(0,28),(1,38),(3,47),(8,57),
                        (16,57),(13,53),(0,33),(-24,24),(-38,12),
                        (-34,6),(-25,10),(-18,4),(-18,2),(10,8),
                        (33,4),(41,10),(47,10),(42,0),(28,-5),
                        (8,1),(-4,5),(-1,9),(4,8),(5,6),
                        (-2,3),(-27,-2),(-51,-12),(-58,-14),(-56,-15) ]
        },
What is being done with the numbers in "pattern"? Are they added to something or are they coordinates?
is coordinates
By "humanized" do you mean jerky? sloppy? erratic? Do you just want the mouse to move smoothly from point to point instead of jumping from point to point to point. Do you want the mouse movement to have rounded corners?

If you want smooth motion between points you just need more points you should look at scipy interp1d. If you want interpolation with smoothed corners look at scipy spline interpolation. Both are discussed here:

https://docs.scipy.org/doc/scipy/tutoria...olate.html
I've used pytweening in the past when I was following a tutorial. I learned from it. Look at this video for visual explanation of interpolation/tweening and see if that suits you.

https://www.youtube.com/watch?v=5WWvqOgQTcY