Then have the cylinder projectile stick inside of the receiving sphere like an arrow. The cylinder projectile would never miss, that means using a navmeshagent component I think, yes?
That tutorial on trajectory motion is very good. And no, it’s not a lot of code for what it does — calculating how to aim to hit a target ballistically takes a bit of math (and he spends more space explaining it than the code itself requires).
But your case sounds different. How exactly are these spheres moving? And how do you expect your cylinder to behave, such that it never misses a moving target? Is this a heat-seeking missile, or is the motion of the second sphere somehow predictable such that you can aim right where it’s going to be when you get there?
The spheres are enemy AI that move via NavMeshAgent towards a static target.
Think of it like throwing a spear towards an enemy, but never missing.
NavMeshAgent did not work as expected as a projectile.
There’s got to be an easy built in way in unity to handle projectiles that fires from a source towards a target (never misses), hit the target then stay stuck in it.
Man this is killing me lol. Aren’t there projectile solutions for unity? How do you just get a spear to get thrown at a moving object and always hit it?
Spears don’t make course corrections. So I can’t imagine that, no matter how hard I try.
What exactly is this spear supposed to do? Does it look into the future, predicting all the zigs and zags of the target, and go in a straight line for where the target will be when it gets there? (And if so, how do we avoid the paradox of the target changing its behavior after the spear is launched?) Or does it follow the target, even looping around it if necessary, all while avoiding other obstacles, like a very smart guided missile?
I don’t see why there’s got to be that. It strikes me as a rather hard problem — but begin by defining exactly what behavior you want, and then we’ll talk about how to achieve it.