Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#ActualBacterius

Posted 20 October 2012 - 10:34 PM

Assuming gravity is the only force on the bomb, and is strictly downwards, and that point does not move while the bomb is in the air (obviously) and that there are no obstacles to consider, then you can in fact work out the exact initial velocity vector needed to hit point . First, let be at coordinates and at coordinates .

Then, using some kinematics, the position of the bomb at any time will be:



So for the bomb to hit somehow, we need the coordinates of the bomb to satisfy:




For some . Rearranging:





Simplifying:




This is a parametric equation in , which basically gives a bigger and bigger velocity vector as you decrease the time (the faster you shoot, the less time gravity has to effect the bomb, so at infinite speed you can pretty much just aim towards B and shoot). As you increase the time , gravity becomes more important (see the gravity term in the equation) and the direction itself matters less, so you get an increasingly large arc. Here's a rough plot of the parametric I made with a throwaway program:

Posted Image

If you need the bomb to stay a certain amount of time in the air, just plug the correct in, and you have your velocity vector! If you need your velocity vector to be a certain length (for instance, the amount of force with which the bomb is launched), you can use that information to deduce as well. You could also calculate the energy requirements for a given and compare them with whatever energy your bomb cannon has to select the correct one, if you wanted to get really fancy.

N.B. This can be generalized to any gravity vector and to higher dimensions by modifying the kinematics accordingly, but for the sake of simplicity and without loss of generality, only gravity in the vertical direction for the two-dimensional case is considered.

#4Bacterius

Posted 20 October 2012 - 10:32 PM

Assuming gravity is the only force on the bomb, and is strictly downwards, and that point B does not move while the bomb is in the air (obviously) and that there are no obstacles to consider, then you can in fact work out the exact initial velocity vector needed to hit point . First, let be at coordinates and at coordinates .

Then, using some kinematics, the position of the bomb at any time will be:



So for the bomb to hit somehow, we need the coordinates of the bomb to satisfy:




For some . Rearranging:





Simplifying:




This is a parametric equation in , which basically gives a bigger and bigger velocity vector as you decrease the time (the faster you shoot, the less time gravity has to effect the bomb, so at infinite speed you can pretty much just aim towards B and shoot). As you increase the time , gravity becomes more important (see the gravity term in the equation) and the direction itself matters less, so you get an increasingly large arc. Here's a rough plot of the parametric I made with a throwaway program:

Posted Image

If you need the bomb to stay a certain amount of time in the air, just plug the correct in, and you have your velocity vector! If you need your velocity vector to be a certain length (for instance, the amount of force with which the bomb is launched), you can use that information to deduce as well. You could also calculate the energy requirements for a given and compare them with whatever energy your bomb cannon has to select the correct one, if you wanted to get really fancy.

N.B. This can be generalized to any gravity vector and to higher dimensions by modifying the kinematics accordingly, but for the sake of simplicity and without loss of generality, only gravity in the vertical direction for the two-dimensional case is considered.

#3Bacterius

Posted 20 October 2012 - 10:31 PM

Assuming gravity is the only force on the bomb, and is strictly downwards, and that point B does not move while the bomb is in the air (obviously), then you can in fact work out the exact initial vector needed to hit point . First, let be at coordinates and at coordinates .

Then, using some kinematics, the position of the bomb at any time will be:



So for the bomb to hit somehow, we need the coordinates of the bomb to satisfy:




For some . Rearranging:





Simplifying:




This is a parametric equation in , which basically gives a bigger and bigger velocity vector as you decrease the time (the faster you shoot, the less time gravity has to effect the bomb, so at infinite speed you can pretty much just aim towards B and shoot). As you increase the time , gravity becomes more important (see the gravity term in the equation) and the direction itself matters less, so you get an increasingly large arc. Here's a rough plot of the parametric I made with a throwaway program:

Posted Image

If you need the bomb to stay a certain amount of time in the air, just plug the correct in, and you have your velocity vector! If you need your velocity vector to be a certain length (for instance, the amount of force with which the bomb is launched), you can use that information to deduce as well. You could also calculate the energy requirements for a given and compare them with whatever energy your bomb cannon has to select the correct one, if you wanted to get really fancy.

N.B. This can be generalized to any gravity vector and to higher dimensions by modifying the kinematics accordingly, but for the sake of simplicity and without loss of generality, only gravity in the vertical direction for the two-dimensional case is considered.

#2Bacterius

Posted 20 October 2012 - 10:29 PM

Assuming gravity is the only force on the bomb, and is strictly downwards, and that point B does not move while the bomb is in the air (obviously), then you can in fact work out the exact initial vector needed to hit point . First, let be at coordinates and at coordinates .

Then, using some kinematics, the position of the bomb at any time will be:



So for the bomb to hit somehow, we need the coordinates of the bomb to satisfy:




For some . Rearranging:





Simplifying:




This is a parametric equation in , which basically gives a bigger and bigger velocity vector as you decrease the time (the faster you shoot, the less time gravity has to effect the bomb, so at infinite speed you can pretty much just aim towards B and shoot). As you increase the time , gravity becomes more important (see the gravity term in the equation) and the direction itself matters less, so you get an increasingly large arc. Here's a rough plot of the parametric I made with a throwaway program:

Posted Image

If you need the bomb to stay a certain amount of time in the air, just plug the correct in, and you have your velocity vector! If you need your velocity vector to be a certain length (for instance, the amount of force with which the bomb is launched), you can use that information to deduce as well.

You could also calculate the energy requirements for a given and compare them with whatever energy your bomb cannon has to select the correct one, if you wanted to get really fancy.

N.B. This can be generalized to any gravity vector and to higher dimensions by modifying the kinematics accordingly, but for the sake of simplicity only gravity in the vertical direction for the two-dimensional case is considered.

#1Bacterius

Posted 20 October 2012 - 10:25 PM

Assuming gravity is the only force on the bomb, and is strictly downwards, and that point B does not move while the bomb is in the air (obviously), then you can in fact work out the exact initial vector needed to hit point . First, let be at coordinates and at coordinates .

Then, using some kinematics, the position of the bomb at any time will be:



So for the bomb to hit somehow, we need the coordinates of the bomb to satisfy:




For some . Rearranging:





Simplifying:




This is a parametric equation in , which basically gives a bigger and bigger velocity vector as you decrease the time (the faster you shoot, the less time gravity has to effect the bomb, so at infinite speed you can pretty much just aim towards B and shoot). As you increase the time , gravity becomes more important (see the gravity term in the equation) and the direction itself matters less, so you get an increasingly large arc. Here's a rough plot of the parametric I made with a throwaway program:

Posted Image

If you need the bomb to stay a certain amount of time in the air, just plug the correct in, and you have your velocity vector! If you need your velocity vector to be a certain length (for instance, the amount of force with which the bomb is launched), you can use that information to deduce as well.

You could also calculate the energy requirements for a given and compare them with whatever energy your bomb cannon has to select the correct one, if you wanted to get really fancy.

PARTNERS