1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Solving for the Direction of a Force

  1. Jan 28, 2008 #1
    Hello, everyone. I've been working with this physics problem for about a week without much success, and this looked like a good place to get some help.

    Here's the issue. I'm programming a game where the main character has the ability to move objects with telekinesis (by applying a constant force). It uses an entirely 2-dimensional physics engine.

    However, it would be very difficult to control the objects if they accelerated directly towards the cursor. If the object had an initial velocity before the force was applied, or if there was some other force acting on the object (namely gravity), it would end up arcing around the cursor. I want to develop a system where the object accelerates at a specific angle so that it passes directly through the cursor.

    I need a method to solve for the angle the object should accelerate at when under the control of the telekinesis. The magnitude of this force, the angle and magnitude of the object's current velocity, the angle and magnitude of the sum of all other forces, and the horizontal and vertical distances that must be covered are all known constants that would need to be entered into the equation.

    You can see my work here (hopefully you can read it):
    http://img178.imageshack.us/img178/8269/tempyr6.png [Broken]
    The three circled equations near the bottom are as far as I could go before I got stuck. Even my graphing calculator wasn't able to solve for theta.

    Hopefully you understood all that. If you have any suggestions for how to solve this, please tell me. I'm running out of ideas.
    Last edited by a moderator: May 3, 2017
  2. jcsd
  3. Jan 30, 2008 #2


    Staff: Mentor

    This is the approach I would take:

    x = 1/2 (Fxo/m + Fx/m) t^2 + vxo t + xo
    y = 1/2 (Fyo/m + Fy/m) t^2 + vyo t + yo
    Fx^2 + Fy^2 = F^2

    where m is the object mass, (x,y) is the cursor location, (Fxo,Fyo) is the sum of all of the other forces, (Fx,Fy) is the telekenisis force, F is the magnitude of the telekenesis force, (vxo,vyo) is the initial velocity, (xo,yo) is the initial position, and t is the time at which the object reaches the cursor. You have three unknowns, Fxo, Fyo, and t, and three equations.
  4. Feb 1, 2008 #3
    That's easier said then done. I've tried using another route to solve this problem, but still ended up getting stuck.

    You can see my work here:
    http://img2.freeimagehosting.net/uploads/1823d86e2d.png [Broken]
    Last edited by a moderator: May 3, 2017
  5. Feb 2, 2008 #4
    I have an idea, but it involves bisection or some other way of solving a 4-th degree polynomial equation (of a single variable).

    1. Write the distance between object and goal s(t) as a function of time, if you chose to
    apply no force (except natural forces).

    2. The area your object can reach is the circle with radious a*t*t/2 around the point where object would be without artificial force. This means that the shortest time t when your object can reach it's aim is the time when that circle touches aimed point. The equation for t is:


    This equation is polynomial, 4-th degree. I read formula exists, but it is ugly. But you can
    use bisection, since
    s(t)>a*t*t/2 for too large t
    s(t)<a*t*t/2 for too small t

    After you find the right t, direction of force is simply the direction between point where object would be (at time t) without force and the aimed point.
  6. Feb 3, 2008 #5


    Staff: Mentor

    Yes, this is much easier said than done. As Lojzek mentioned the system that you are trying to solve is 4-th order. I would not even attempt its solution by hand. You should either use a math package like Mathematica or you should use a numerical solver.

    Just for grins I plugged the system into Mathematica, it came up with 4 roots, each of which was hundreds of pages long.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook