Jump to content

Looking for maths genius asap pls


Recommended Posts

Take the following:


Where point B moves towards point A in a curvey fashion.


I have this code:

double theta = Math.atan(diff.getY() / diff.getX());
double newX = Math.cos(theta);
double newY = Math.sin(theta);
x += newX;
y += newY;

Where diff is a vector of ((a.x - b.x), (a.y - b.y))


In theory, this should work, however: (where point A is the mouse position and point B is the ball)



How would I go about fixing this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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