Answers for "rocketscience - how to find out what force is needed to hit a specific target"
http://answers.unity.com/questions/407480/rocketscience-how-to-find-out-what-force-is-needed.html
The latest answers for the question "rocketscience - how to find out what force is needed to hit a specific target"Answer by steakpinball
http://answers.unity.com/answers/407577/view.html
Set `rigidbody.velocity` to the desired value.
The equation `t = (-sqrt(2 * a * y - 2 * a * y_0 + (v_y0)^2)-v_y0) / a` will give you the time it takes to move in the y direction. Use that in `v_x = (x - x_0) / t` to get the initial horizontal velocity. Where:
- `a` is acceleration due to gravity
- `y` is destination y position
- `y_0` is starting y position
- `v_y0` is initial y velocity
- `x` is destination x position
- `x_0` is starting x position
- `v_x` is desired x velocity
You can even make it one formula if you are feeling adventurous. Please don't make me write the literal code for this formula.
http://www.wolframalpha.com/input/?i=Solve+%5By%3D%3Dy_0%2Bv_0*t%2B%281%2F2%29at%5E2%2C+t%5D
http://www.wolframalpha.com/input/?i=Solve+%5Bx%3D%3Dx_0%2Bv_0*t%2C+v_0%5DWed, 27 Feb 2013 13:13:07 GMTsteakpinballAnswer by Tarlius
http://answers.unity.com/answers/407563/view.html
I think you want to use [velocity][1], not force.
[AddForce][2] is for applying a constant/varying force over time.
While you could work out the force you would need to apply for 1/60s (or whatever your physics simulation is running at) to get the required velocity, it'd be easier to just use velocity.
I'm pretty sure you'll be wanting [this][3] to solve the problem. I'm going to keep thinking on it for a more specific solution because this is a pretty interesting question :)
By the way: there will be times when it will be impossible to hit both with a fixed starting upwards velocity. Is that intended?
Or have I misunderstood the question and you actually mean to apply force throughout the simulation (which won't produce the parabola in your diagram) and we're looking at something more like a homing missile?
Edit: Also- is the second plate always at ground level? I think its solvable even if not, but it would probably simplify things a lot
[1]: http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-velocity.html
[2]: http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddForce.html
[3]: http://en.wikipedia.org/wiki/Equations_of_motionWed, 27 Feb 2013 12:48:05 GMTTarlius