I have two plates with different positions in space like shown in the image. I need to find out what side-force is needed to shoot a misile from one plate to another. the up-force is given, the rocket has mass = 1.
I need to calculate the side-force that is needed to hit the second plate in its center to use it in
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.
AddForce 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 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