Search Unity

How do you calculate drag to make a rigidbody stop at a given position?

Discussion in 'Physics' started by jlink, Sep 5, 2019.

  1. jlink

    jlink

    Joined:
    Jan 8, 2017
    Posts:
    6
    I have a projectile that uses physics that I want to stop at a given position. I can apply a force in the direction of the position to make it cross the position, but how can I calculate and set drag so that the object stops at the target position?

    As a bonus question, how can I calculate the drag and velocity required to make the object stop at a given position AND given time?
     
  2. jlink

    jlink

    Joined:
    Jan 8, 2017
    Posts:
    6
    * bump *
     
  3. xorpheous

    xorpheous

    Joined:
    Mar 28, 2018
    Posts:
    17
    The equation you're trying to solve is (d^2/dt^2)r = -g - (C_d / m)* |dr/dt|^2 * dr/dt

    You can't solve this explicitly for r(t) = stuff. The best you can do is model it numerically. You CAN solve for the non-drag solution in closed form using the constant acceleration equation, r(t) = r_i + v_i * t + (1/2) a t^2. If you're going over flat terrain, then your total range is |r| = (v^2 / g) * sin(2 * angle). Again, that's without drag.
     
    jlink likes this.
  4. jlink

    jlink

    Joined:
    Jan 8, 2017
    Posts:
    6
    Thanks, that helps!