Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: Not Selected
more ▼

asked Jul 22 '14 at 09:56 PM in Blueprint Scripting

avatar image

6 3 4 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jul 23 '14 at 04:22 AM

avatar image

3.4k 154 52 271

avatar image VomitInject Jul 23 '14 at 08:13 AM

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!

avatar image VomitInject Jul 23 '14 at 02:16 PM

If you could show me the setup in engine i would appreciate it like hell! :D But i understand if that's to much of a time waist! ^^

All the best!

avatar image mindfane Jul 23 '14 at 03:45 PM

I will try to. But I wont be free until tomorrow. If you can wait, I will post it here tomorrow evening.

avatar image VomitInject Jul 23 '14 at 04:46 PM

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! ^^

avatar image mindfane Jul 24 '14 at 03:10 PM

Here you go:

You need two BPs:

  1. MyCharacter (extended from Character) I am using the one from ThirdPerson template with some modifications. I added a Fire event on Mouse Button click and defined the listener ass below: alt text

  2. BP_ReturningProjectile (extended from Actor). I defined a custom function Shoot Me and overrode the Tick and OnHit events as below alt text


  1. You must create BP_ReturningProjectile first. Otherwsie you wont be able to call ShootMe from charcter blueprint

  2. The graphs are based on another project I am working on. So they are not optimal. There some some unwanted casts and branches. But I am sure you can clean those up

  3. You will need additional logic to do something when it hits an enemy,wall and when it returns to you, Its entirely upto you

  4. Notice that I sued the method where I store the Actor to return to. So this work even if the shooter moves. Again, I am not using the ProjectileMovement component for more flexibility.

  5. You might wan to alter the collision channel settings to suit your needs.

Hope this helps:

The blueprint are self explanatory, I think. If you have any doubts, don't hesitate to ask

avatar image Deathstroke101 Dec 29 '14 at 06:57 PM

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.

avatar image mindfane Dec 30 '14 at 02:38 AM

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.

avatar image VomitInject Jul 25 '14 at 01:02 PM

I think i got most of it, a few things im a little iffy on. Can i add you on skype or something? :)

avatar image mindfane Jul 28 '14 at 07:08 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question