Get Projectile hit moving target

  • Thread starter calthabis
  • Start date
  • Tags
    Projectile
In summary, the conversation discusses a coding project involving a 2D space with a projectile and a target. The target has a constant y coordinate and a variable x coordinate due to its velocity. The projectile has a given starting speed and angle, and is affected by gravity. The goal is to find a formula to determine the angle needed to hit the target. The conversation goes on to discuss possible equations and approaches for solving the problem, ultimately recommending the use of a numerical solver for coding purposes.
  • #1
calthabis
3
0
Hello i need this för a coding project I am currently occupying myself with =)

ok so the system is in a 2D space, the projectile starts at a height H and is supossed to hit target T. the targets y.coord is constant Ty but his x has a speed Tv towards the projectiles start. the target starts at a distance D from the projectile. the projectile has a given starting speed of Pv0 and the angle A.

oh right and gravity is affecting the projectile =)SO! what i need is a formula that can tell what angle I need to hit the target.

Thanks in advance
 
Last edited:
Physics news on Phys.org
  • #2
Was this too difficult or is there not enough information??
:confused:
 
  • #3
You can write an expression for the location of the projectile as a function of t and the angle, and you can write an expression for the location of the target as a function of t. Set them equal to each other and you have an equation describing when they collide. That leaves 2 equations in 2 unknowns so you can solve for t and the angle.
 
  • #4
This is how far I've got. I am stuck so can you please say how i can solve the rest or if there is some other way to solve it.
it might be quite hard to follow on screen so i suggest you follow my calculations on paper.

the target's y coordinate is always 0

Tv = the target's X velocity (speed)
Pv = the projectile's velocity

d0 = the target's x coordinate at t=0
y0 = the projectile's y coordinate at t=0


Pvx = Pv * cosa
Pvy = Pv * sina +gt

Px = Pv *cosa *t
Tx = d0 + Tv *t
Py = y0 + Pv* sina + (g*t^2) / 2
Ty = 0


Tx = Px
Ty = Py


(1.) d0 + Tv *t = Pv *cosa *t
(2.) 0 = y0 + Pv* sina + (g*t^2) / 2


(1.) cosa^2 = ( ( d0 + Tv *t )/(Pv * t) )^2
(2.) sina^2 = (( -y0 -(g*t^2) / 2 ) / Pv)^2


cosa^2 + sina^2 = 1
(1.) + (2.) = 1

( ( d0 + Tv *t )/(Pv * t) )^2 + (( -y0 -(g*t^2) / 2 ) / Pv)^2 = 1
 
  • #5
You shouldn't try to solve this by hand. You should either plug the equations into a symbolic math package, like Mathematica, or you should solve it numerically. Just for grins I used Mathematica. I had these two equations describing repectively the x and y coordinates of the collision:

T0x + t Tvx == Pv t Cos[a]
2 P0y + g t^2 + 2 Pv t Sin[a] == 0

Solving this simple appearing system for t and a resulted in 8 roots, each one of which was over 100 pages of output.

You could probably solve this a more clever way to get fewer roots and slightly simpler expressions. One typical way is to not solve for the angle but rather the x and y components. But you would never get something truly simple. If you are coding I would recommend using a numerical solver. There are lots of packages available, many for free.
 
Last edited:

1. How do I calculate the trajectory of a projectile?

The trajectory of a projectile can be calculated using the projectile motion equations, which take into account the initial velocity, angle of launch, and acceleration due to gravity.

2. What factors affect the accuracy of a projectile hitting a moving target?

The accuracy of a projectile hitting a moving target is affected by factors such as wind speed and direction, the speed and direction of the moving target, and the initial velocity and angle of launch of the projectile.

3. How can I increase the chances of hitting a moving target with a projectile?

To increase the chances of hitting a moving target with a projectile, you can adjust the initial velocity and angle of launch to compensate for factors such as wind and target movement. Additionally, using a more accurate and precise launching mechanism can also improve accuracy.

4. Is there a specific type of projectile that is best for hitting a moving target?

The best type of projectile for hitting a moving target depends on various factors such as the speed and direction of the moving target, the distance to the target, and the accuracy and precision of the launching mechanism. It is important to consider these factors when choosing a projectile.

5. How can I account for the curvature of the Earth when aiming at a distant moving target?

To account for the curvature of the Earth, it is important to consider the effects of gravity and the angle of launch. The projectile motion equations can be used to calculate the trajectory of the projectile, taking into account the curvature of the Earth.

Similar threads

Replies
2
Views
3K
  • Introductory Physics Homework Help
Replies
11
Views
691
Replies
3
Views
897
Replies
4
Views
10K
Replies
6
Views
976
Replies
8
Views
1K
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
4
Views
811
Replies
11
Views
1K
Back
Top