- Home /
I want to find out how to make a projectile home in on a target with an "arc".
Basically, I want the projectile to go towards the target in an arc. If the player moves, it should follow them. So far, what I have is the projectile instantiating in front of the player and then going towards the target in a line (using transform.lookat and transform.translate). I have zero clue on where I should go from here.
Green is the player, red is the target.
If you use rigidbodies and physics, there are a couple of solutions here :
http://answers.unity3d.com/questions/148399/shooting-a-cannonball.html
http://answers.unity3d.com/questions/248788/calculating-ball-trajectory-in-full-3d-world.html
Great! These help me with the "arc" part. Now I just need to figure out how to combine both ideas.. thanks!
Ok, I played around with it and it's working a pretty well! I just used the same Transform.Translate/Transform.Lookat stuff I used before and modified the variables in them a bit. It's a bit wonky but acceptable. If anyone has a better way to do this, please show me, but otherwise, thanks alucardj!
you need to learn about the physic engine champ, as ALU explains.
go to UnityGE$$anonymous$$S.com for a vast inrtoduction for beginners
Answer by Cygon4 · Nov 28, 2012 at 12:49 PM
There's a free library for Unity called "iTween" which can calculate splines, including ones that match a ballistic curve (and of course end with a picture-perfect landing on the desired spot).
The first example on its website might that already closely resemble what you're trying to do: http://itween.pixelplacement.com/examples.php
Your answer
Follow this Question
Related Questions
Aim preview for projectile trajectory 1 Answer
How do I arc a rigidbody so it lands on a target? 2 Answers
Arcing projectile using physics 0 Answers
help with shooting projectile along a curve path 1 Answer
Setting limits to my trajectory 2 Answers