Sign in to follow this  
Followers 0
hlstriker

Adding 'gravity' to mousemove?

7 posts in this topic

Hi, is there a way to make the mouse get pulled in a direction so the movement isn't a straight line. I need to try and find a way to have the mouse get pulled around but still get to it's original destination.

When using autoit's mousemove the cursor will follow a straight line with no 'bending' what so ever. I need to try to emulate a real life persons mouse movement. When a human moves the mouse it doesn't go in a direct straight line, it has a bit of a 'bend' to it.

Share this post


Link to post
Share on other sites



Hi, is there a way to make the mouse get pulled in a direction so the movement isn't a straight line. I need to try and find a way to have the mouse get pulled around but still get to it's original destination.

When using autoit's mousemove the cursor will follow a straight line with no 'bending' what so ever. I need to try to emulate a real life persons mouse movement. When a human moves the mouse it doesn't go in a direct straight line, it has a bit of a 'bend' to it.

You would have to write an algorithm to do this. May i ask, what is this for?


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Try using an antigravity algoritum.

Some Java Code (Credit to Hanji from the robowiki):

http://robowiki.net/cgi-bin/robowiki?Hanji/AGravEngine

/**
     * Calculates the current force and kills any GravPoints
     * that have gone past their lifetimes
     * @param curX The X coordinate of the point for which
     * gravity is being calculated.
     * @param curY The Y coordinate of the point for which
     * gravity is being calculated.
     * @param time The current time.
     **/
    public void update(double curX, double curY, long time) {
        xForce = 0.0;
        yForce = 0.0;
        Vector deadPoints = new Vector();
        GravPoint g;
        double force;
        double angle;
        for(int i=0;i<gravPoints.size();i++) {
            g = (GravPoint) gravPoints.elementAt(i);
            if(g.update(time)) {
                deadPoints.add(g);
                continue;
            }
            force = g.strength/Math.pow(
                                RobocodeUtils.dist(curX, curY, g.x, g.y),
                                pointDropoff);      
            angle = RobocodeUtils.getBearing(curX, curY, g.x, g.y);
            xForce += force * Math.sin(angle);
            yForce += force * Math.cos(angle);
        }
        xForce += wallForce/Math.pow(curX, wallDropoff);
        xForce -= wallForce/Math.pow(width-curX, wallDropoff);
        yForce -= wallForce/Math.pow(height-curY, wallDropoff);
        yForce += wallForce/Math.pow(curY, wallDropoff);
        
        for(int i=0;i<deadPoints.size();i++) {
            gravPoints.remove(deadPoints.elementAt(i));
        }
    }

#)

Share this post


Link to post
Share on other sites

You would have to write an algorithm to do this. May i ask, what is this for?

Most likely for a game bot...

I'm not him, however, so I don't know for sure. That's my guess, though.

I'm also creating one atm to accompany an EQ2 bot.


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

If it's for a game bot, you just need to randomize the clicks. Instead of making it move different ways on the way to the click, have it click random X-Y around a certian area.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0