How do I calculate the force needed to hit a certain target from a certain angle?

I’m making a game around firing a cannon and getting more distance as the gun is upgraded.

My initial thought was to have a force number and somehow apply it to a Bezier curve to hit a point that is not explicitly predetermined, but I realized it might have been too complicated. (I would still like help on this!)

I changed my mind, and instead went for a system like hitting a specific zone (in picture) with the zone’s distance from the player tower distance being upgraded as the player progresses.

I want to know how much force I would need to apply to my projectile in order to have a flatter arc (also in picture) and hit the zone predetermined through upgrades, and somehow have the arc’s impact point be scaled with the tower’s height being upgraded.

Ideal curve/projectile trajectory example:

(It would be somewhat similar to the game “Be a Paper Airplane”, in a sense that there is distant range and tower height involved)

Edit: Here is an oPhysics simulation for a more mathematical perspective:

2 Likes

Assuming the trajectory starts off perfectly horizontally, the time which the projectile is airborne can be calculated using the equation:
Vertically,
image
Initial velocity, u, = 0 since it’s perfectly horizontal since there’s no velocity acting vertically.
therefore the time airborne,
image
where s is the displacement between the turret and the ground and a is the gravitational acceleration.
Since we have the time airborne, the range can be calculated by:
image
This is trivial since horizontal velocity remains constant in projectile motion.

1 Like

I’m sorry, but how would I get the force needed for the projectile to hit the specified distance out of these equations, or how would this be translated into a force number/Vector3 for the first option?

1 Like

Do you mean an impulse? In projectile motion, there is no sustaining force other than the weight of the projectile.

1 Like

Yes, sorry. I meant the impulse. Would this be the starting velocity from the oPhysics simulation linked in the original post?

1 Like

the following equations can be rearranged to get
image

You can easily apply this to 3d since you can think of it as a 2d plane in a 3d world.

1 Like

To clarify, Sh would be the initial velocity, which would be divided by the time airborne?

1 Like

No, Sh is the horizontal displacement, Vh is the intial velocity.

1 Like

So the initial velocity is the horizontal displacement divided by the time airborne, but the horizontal displacement is the initial velocity (which is being calculated) multiplied by the time airborne? (P.S. I am sorry if this should be a simple thing, I haven’t learned too much about physics yet.)

1 Like

No, the horizontal displacement is not the initial velocity. It’s the vertical distance between the turret and the ground.