Sign in to follow this  
krio123

hunter and target - meeting point

Recommended Posts

I have 2 objects in 3d space: hunter and target I have hunter position (H), hunter direction/speed vector (Hs), target position (T) and target speed (length(Ts)), not vector. I need to find nearest meeting point which hunter should fly to to meet target in minimum time I have intersection of this two lines: H+t*Hs = T+t*Ts (where t is 'time' in program cycles), but I have neither t nor Ts (only its length) to find the solution. How should I solve it? Thanks a lot!

Share this post


Link to post
Share on other sites
I think you have insufficient information. If you don't know the direction that the target is moving in, how can the hunter know where to turn to intercept? There needs to be some other constraints. Also, you have the hunter's initial velocity only right? Based on your question, it can change directions but is it's speed constant?

I'm guessing you might know the previous target position. If so, then you can determine the last velocity direction of the target and move the hunter in the direction to intercept. You say you don't know t, but you should have that if it is program cycles.

delta_T = T2 - T1; // change in target position
delta_t = t2 - t1; // change in time (this should just = 1 if you are measuring time in program cycles
Ts1 = delta_T/delta_t; // target velocity is the change in position over time

So now you know which direction the target was moving in and you can move the hunter to close in. But from that you can't determine the meeting point without running to intercept unless there are other constraints (like constant velocity target).

But unless you have certain rules, it will always be possible that you would never intercept. For example, if the target is too fast.

Hope that helps some, but I think we need more info somehow.

Share this post


Link to post
Share on other sites
The common situation is that you know the target's velocity (the vector) and the hunter's speed, and you need to know in what direction the hunter should move. This was discussed in this thread.

If this is not what you need, try to explain the situation in a little more detail. A simple example that can be solved by hand would be nice.

Share this post


Link to post
Share on other sites
I have both hunter direction vector (Hs) and its speed (length(Hs)).

Alvaro, the topic you recomment is the one I'm looking for - but I need implementation for 3D space and I'm not familiar with C++ notation 8-(
Could you please recommend topic / article devoted to the problem?

Share this post


Link to post
Share on other sites
Besides providing code, I also explained the computations in that thread. The 3D and 2D cases are identical.

I don't know of any tutorials that explain this problem. Let me know what part of my description you don't understand (or don't know how to code) and I'll try to explain it better.

What programming languages do you know?

Share this post


Link to post
Share on other sites
Alvaro,
thanks a lot, your step by step description in that topic is VERY good. I use VB and it seems to me that I'll be able to convert C example there.
But I wonder what if
- target speed is greater than hunter speed?
- target speed is 0?
what will happen with the calculation in this cases?
should I track (b*b-4*a*c) < 0 case (and when it could happen?) or it is impossible here?
thanks a lot!

Share this post


Link to post
Share on other sites
What I posted in the other thread was assuming bullets move faster than targets. If this is not the case, you can end up with no solutions, two positive solutions or two negative solutions. You should check the sign of the discriminant (b*b-4*a*c) and pick the smallest positive root, if there is one.

Share this post


Link to post
Share on other sites
Alvaro, thanks a lot for reply, but in the other thread you said that the larger solution is the one we are interested in.
So which root should be taken?

Yes, I need to handle case when target moves faster than hunter (it's ships, they move slower than bullets) - how to determine if hunter can't intercept target basing on the equation?

thanks a lot!

Share this post


Link to post
Share on other sites
Quote:
Original post by krio123
Alvaro, thanks a lot for reply, but in the other thread you said that the larger solution is the one we are interested in.
So which root should be taken?

You want a positive root. If you have two, it's up to you which one you want to use, but presumably you want to hit your target as soon as possible.

What I posted in the other thread, as I said, is assuming bullets are faster than targets. In that case there will be a positive solution and a negative solution, so we want the positive one.

Quote:
Yes, I need to handle case when target moves faster than hunter (it's ships, they move slower than bullets) - how to determine if hunter can't intercept target basing on the equation?

If there are no positive solutions, the hunter can't intercept the target.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this