Returning a Projectile to it's origin.
I'm trying to figure out how to make a projectile act like this: https://www.youtube.com/watch?v=SS3PJIMPOHQ
I want to fire it and then have it return to the source. In my case the source will be stationary.
All the best! Daniel
Create a custom projectile blueprint class. Add a variable inside it. It can be a Vector (if your return point does not change), or of Type Actor if your return point changes (for example if you want ti to return to your character).
When the Projectile is spawned, store the return point in the variable we created above (OR store a reference to the Actor to which the projectile should return)
IF you want to return the projectile when it hits something, you must override the OnHit event in the projectile blueprint. Calculate the vector from its current location to the return point (this is where you use the variable we created earlier). This cane be achieved by doing 'ReturnVector = Return point - Current location' (IF you are storing the reference to Actor, be sure to use Get Actor Location node).
Once you are here, all you have to do is change the Velocity of the Projectile movement component to BaseVelocity*ReturnVector.
But you will have more control if you dont use 'ProjectileMovement' component and instead calculate the movement by yourselves in the tick event of the projectile.
Hope this helps.
answered Jul 23 '14 at 04:22 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here