rocketscience - how to find out what force is needed to hit a specific target

hi folks!

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.

8342-rocketscience.jpg

I need to calculate the side-force that is needed to hit the second plate in its center to use it in

missile.rigidbody.AddForce(new Vector3(SIDEforce,UPForce, 0));

by only using the given up-force and the distance-vector between the two plates.
any hints? thnx!

EDIT: the second plate is meant to be on a higher level than the first one. its y-position is bigger than the one of the first plate.

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.

I think you want to use velocity, not force.

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 :slight_smile:

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