Jump to content

Looking for maths genius asap pls


Recommended Posts

Posted

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?

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
  • Recently Browsing   0 members

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