Hello!
I’m trying to figure out how to make a projectile act like this:
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
Hello!
I’m trying to figure out how to make a projectile act like this:
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.
Yeah it’s super good, very nice!
Tho I’m to much of a noob in the Blueprint department to set it up I fear!
If you could show me the setup in engine i would appreciate it like hell!
But i understand if that’s to much of a time waist! ^^
All the best!
I will try to. But I wont be free until tomorrow. If you can wait, I will post it here tomorrow evening.
Oh thanks you so SO much!
I can absolutely wait, I’m making the FX atm, will give you credit when I post if of course! ^^
Here you go:
You need two BPs:
Notes:
Hope this helps:
The blueprint are self explanatory, I think. If you have any doubts, don’t hesitate to ask
I think i got most of it, a few things im a little iffy on.
Can i add you on skype or something?
I cannt be on skype. But if you have any doubts, you can find me in the forums. Feel free to PM me.
Sorry for the late reply. I was very busy with something for the last couple of days.
Could you explain how to make the projectile destroy itself after coming back ? I have tried the whole BP but the projectile barely reaches me and gets stuck on the player.
Simplest answer would be to use the ‘Begin Overlap’ event of the projectile and cast the other actor to your character’s class. If its a success, call the destroy node.
However you will need to properly configure the collision channels to generate overlap events.