Jump to content

Looking for maths genius asap pls


Bobrocket

Recommended Posts

Take the following:

6a79e4efebc04d0225d2aa7d1337e107.png

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)

5cfc66c85217969a639a5193008b5a8e.gif

 

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.
Note: Your post will require moderator approval before it will be visible.

Guest
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...