Jump to content

Adding 'gravity' to mousemove?


 Share

Recommended Posts

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.

Link to comment
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

Link to comment
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));
        }
    }

#)

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

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