This topic is 3151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
You know that the projectile's path must lie in the plane defined by the line of the target's motion and the point of the projectile's origin.

To approach this, I would transform it into a two-dimensional problem. You have a triangle defined by the target's position, the projectile's position, and the point of intersection of their paths. You know the distance between the target and projectile and the angle of the target's path relative to the projectile's current position. You also know the ratio between the projectile's velocity and the target's velocity.

This lends itself very well to using the law of cosines. If a is the distance between the target and projectile, b is the distance between the target and point of intersection, c is the distance between the projectile and point of intersection, and theta is the angle between the vector between projectile and target and the target velocity vector, then:

c=b*Pvco/abs(Tvel)
b^2*(Pvco/abs(Tvel))^2=a^2+b^2-2ab*cos(theta)

b is the only unknown, so you can solve this with a simple quadratic equation. You want the smallest value of b that is still positive; a solution will exist as long as the projectile is faster than the target.

cos(theta) is simply the dot product of the normalized velocity vector and the normalized difference between the two positions.

Once you know b, the rest of the problem is trivial:

t=b/abs(Tvel)
Pvel=(Tpos+Tvel*t-Ppos)/t
Pdir=norm(Pvel)

I just sketched this up quick on pencil and paper; I didn't actually test it.

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 14
• 9
• 10
• 12
• 17
• ### Forum Statistics

• Total Topics
632907
• Total Posts
3009161
• ### Who's Online (See full list)

There are no registered users currently online

×