A
AurimasMB
I am working on a simple particle simulator, one of my first JAVA
apps, and I'm having some difficulty with Inverse Tangents. My first
goal is to have the particles move towards the mouse. Finding the
angle between those two points, from what I understand of geometry, is
done using the Inverse Tangent of (Y Distance / X Distance) between
the two points.
m_ang = Math.toDegrees(Math.atan((y_pos - my)/(x_pos - mx)));
x_pos and y_pos is the location of the particle, while mx and my are
the location of the mouse.
I've yielded all manner of interesting results with the simulator, but
I have not been able to make the particles all point at the mouse.
Sometimes the particles will all point towards the mouse from above,
but once past it, will continue to point away from it. Does this mean
I have to split the function into two parts?
Any suggestions?
apps, and I'm having some difficulty with Inverse Tangents. My first
goal is to have the particles move towards the mouse. Finding the
angle between those two points, from what I understand of geometry, is
done using the Inverse Tangent of (Y Distance / X Distance) between
the two points.
m_ang = Math.toDegrees(Math.atan((y_pos - my)/(x_pos - mx)));
x_pos and y_pos is the location of the particle, while mx and my are
the location of the mouse.
I've yielded all manner of interesting results with the simulator, but
I have not been able to make the particles all point at the mouse.
Sometimes the particles will all point towards the mouse from above,
but once past it, will continue to point away from it. Does this mean
I have to split the function into two parts?
Any suggestions?