This is not a homework problem so i didn't post it in that section, however, it is homework-problem-ish in that it's a problem for a non-school-related programming simluation project I'm working on that I can't solve. If appropriate, please move to that section.(adsbygoogle = window.adsbygoogle || []).push({});

Overview: I'm working on programming a simulation that requires 'shooting' projectile-type objects at other moving objects. How can I calculate the angle at which to shoot the object to hit?

Details:

Imagine you're holding some gun-type object that shoots projectiles at velocity Vd in straight lines. You are moving with Speed Vp at angle Theta_p, in a straight line. Another object, which we will name the target, is located a distance R away from you at an angle Theta_tp, and is moving in a straight ine with velocity Vt at angle Theta_t.

I need to calculate the angle Theta_a I should aim the gun in order to hit the target. The target is moving so you need to lead it with your shot to compensate. Also, the projectile will inherit your velocity on top of its own since you are also moving, which will further modify the angle you need to shoot at.

It seems to me that the strategy should be that I find a point in space which will be occupied by both the projectile and the target. I know all the points in space that the target will take along its linear path, and the times at which it will take all points. However, because the total velocity of the projectile varies based on the angle you shoot it (e.g. the magnitude of the velocity vector will be different depending on what Theta_a you decide to shoot at), I'm not sure how to figure out where to shoot it.

Any help would be appreciated!

In addition, if it is easy, a solution to a target moving in a circular path with radius R (same R as the distance between you and it, so it's making a perfect circle around you) would be appreciated!

Thanks!

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Fire projectile to hit a moving object

**Physics Forums | Science Articles, Homework Help, Discussion**