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.
Assuming the trajectory starts off perfectly horizontally, the time which the projectile is airborne can be calculated using the equation:
Vertically,
Initial velocity, u, = 0 since it’s perfectly horizontal since there’s no velocity acting vertically.
therefore the time airborne,
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:
This is trivial since horizontal velocity remains constant in projectile motion.
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?
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.)