Fire projectile to hit a moving object

  • Thread starter Thread starter RuneStrife
  • Start date Start date
  • Tags Tags
    Fire Projectile
AI Thread Summary
The discussion focuses on calculating the angle to shoot a projectile at a moving target in a simulation project. The user needs to account for both their own movement and the target's movement, requiring a method to determine the intersection point in space over time. They initially approached the problem using scalar magnitudes but are now considering vector addition for a more accurate solution. A formula was shared to calculate the time of intersection based on the positions and velocities of the gun and target. The user is also exploring the concept of directional inheritance for projectile velocity, seeking further assistance on this aspect.
RuneStrife
Messages
3
Reaction score
0
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.

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 news on Phys.org
Pretend as though your origin is stuck to the gun, add the negative of the guns velocity to the target (same magnitude, just reverse direction), this really will simplify things for you.
Now you can separate the target's velocity into an x-component (V_{target}\cos \theta_{target}) and a y-component (V_{target}\sin \theta_{target}) and solve these simultaneously with the "bullet's" motion relative to the gun.
 
Thanks for the reply. In fact this has been exactly my approach so far. Before posting this message, I've been able to figure out how to hit a moving target while gun is stationary by doing the following:

1. Figure out the length of the radius between target and gun as a function of time, where gun is always at the origin and not moving.

2. I can then divide that by the magnitude of projectile speed to get a quadratic that gives the time of intersection with the target and get the angle of R at that time.

My problem is that when the gun moves, the magnitude of the projectile speed would vary as a function of the angle you shoot at, because it would inherit the gun's velocity vector (constant angle) plus its own velocity (at the angle to aim) so to calculate the gun's velocity magnitude I'd need to already have the angle I'm looking for.

However, after some thinking I'm going to try to redo the problem through vector addition instead of converting stuff to scalar magnitudes and such, which may (or may not) simplify things.
 
I think your problem of intercepting a moving object can be solved by using the methods of missile guidance trajectories. Here is an article you may be able to use. See:

http://www.jhuapl.edu/techdigest/TD/...mbo_Homing.pdf

“Figure 2. Planar engagement geometry. The planar intercept problem is illustrated along with most of the angular and Cartesian quantities necessary to derive modern guidance laws.”
 
Actually i was able to solve the problem using the equation:

|T-G-t*(VT-VG)|=D*t

where T and G are target and gun position vectors, VT and VG are velocity vectors for target and gun, D is the projectile default velocity, and || is the magnitude of the sum of those vectors (add the x and y components as above, square them, add that, take the square root, divide by D).

This should give me t to intersect, and then I can plug that into those X and Y components (from the equation above) and take the atan() of those to get the angle.

Now I moved onto the next step of the problem which is to compare normal inheritance to Directional inheritance, defined such that the projectile only inherits the projection of the gun's velocity on the vector along which it is fired (which is not the vector along which it moves).

Any help with this would also be appreciated. Currently I've modified the vector components in the above equation such that VP components have been changed from:

(VG*cos(Theta_G)i, VG*sin(Theta_G)j)

to:

(VG*cos(Theta_T-Theta_G)^2)i, (VG*cos(Theta_T-Theta_G)sin(Theta_T-Theta_G))j

where Theta_T is the angle defined by the radius drawn from (0,0) to the target and Theta_G is the same thing for the gun.

Does this seem correct, and if not, how to proceed?
 
Last edited:
Hello everyone, Consider the problem in which a car is told to travel at 30 km/h for L kilometers and then at 60 km/h for another L kilometers. Next, you are asked to determine the average speed. My question is: although we know that the average speed in this case is the harmonic mean of the two speeds, is it also possible to state that the average speed over this 2L-kilometer stretch can be obtained as a weighted average of the two speeds? Best regards, DaTario
The rope is tied into the person (the load of 200 pounds) and the rope goes up from the person to a fixed pulley and back down to his hands. He hauls the rope to suspend himself in the air. What is the mechanical advantage of the system? The person will indeed only have to lift half of his body weight (roughly 100 pounds) because he now lessened the load by that same amount. This APPEARS to be a 2:1 because he can hold himself with half the force, but my question is: is that mechanical...
Thread 'Beam on an inclined plane'
Hello! I have a question regarding a beam on an inclined plane. I was considering a beam resting on two supports attached to an inclined plane. I was almost sure that the lower support must be more loaded. My imagination about this problem is shown in the picture below. Here is how I wrote the condition of equilibrium forces: $$ \begin{cases} F_{g\parallel}=F_{t1}+F_{t2}, \\ F_{g\perp}=F_{r1}+F_{r2} \end{cases}. $$ On the other hand...
Back
Top