- Home /
How to calculate the speed and direction to intercept with a target
Hi,
I need to find a way to calculate the required speed and direction to intercept with a target given the target's current position, speed and direction.
could anybody help me with this problem ?
thanks for your help in advance.
http://wiki.unity3d.com/index.php?title=Calculating_$$anonymous$$_For_Projectiles
http://answers.unity3d.com/questions/54426/calculating-lead-for-a-target-not-a-rigidbody-solu.html
http://answers.unity3d.com/questions/36084/target-tracking-with-lead-time.html
http://answers.unity3d.com/questions/408444/how-to-get-turrets-to-lead-enemies-topdown-2d.html
The term to search for is $$anonymous$$ing Target
Answer by AlanMattano · May 15, 2014 at 04:58 PM
I think you have to use vectors. You have 2 vectors [a,b] and you need the result 3 [r].
Vectors represent a position or a speed
If you pick up actual position and last position of an object you get the actual speed and direction. Use this vector for starting
You know the distance between you and the target, and this can be yous as second vector. Use trigonometry to resolve the equitation.
in a 3d space is much more complex r = square root of ( (x*x) + (y*y) + (z*z )) can be usfull to get the speed and direction vector.
start in 2d is much better. Imagine to intercept using a 90° angle or triangle (this can help). Then you can use Sin or cosine. A triangle has 3 angles. In this case you can choose for starting that one angle is 90°. So is simple to get the other 2 [Alpha1 , Alpha2 ]. And then the final Vector. Example r = a / sin of Alpha
When you finish please edit and expand this answer as you wish.
Your answer
Follow this Question
Related Questions
Reducing rounding errors in my physics solvers 0 Answers
Find angle from velocity 2 Answers
trajectory motion predictor 1 Answer
Projectile isn't reaching my target. 1 Answer
Projectile trajectory velocity and angle instead of force with a rigidbody 2 Answers