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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to despawn a projectile when it gets near the player?

I'm trying to create a homing projectile that that despawns when it gets close to the actor. Using the first person template as a base I've managed to modify the projectile to home towards the player when it spawns, but I can't work out how to despawn it when it gets within 10 metres. alt text

Here is the code snippet I've tried. It is supposed to run when the projectile spawns and check if it is within 10 metres every tick. Any idea what I'm doing wrong?

Product Version: UE 4.12
unreal 1.png (402.6 kB)
more ▼

asked Jul 22 '16 at 01:03 PM in Using UE4

avatar image

3 1 2

avatar image Marooney Jul 22 '16 at 01:48 PM

Hi there, Looks ok. But the length is longer than 1000 every tick? Have you tried to PrintText the length or the locations before the Branch to figure out the results? Because if the results are correct then something else is wrong. Do you get any error in the log?

avatar image SpartanBeef Jul 22 '16 at 04:29 PM


I've tried to to get the location and length(Using the attached blueprint) and in doing so I've found that none of the messages actually appear in game or in the log, even the ones before the branch. The only thing I can think of is that the blueprint never executes for some reason.

There is one error message in the log. It appears whenever two of the projectiles collide, so I'm not sure how relevant it is to the problem.alt text

unreal2.png (105.8 kB)
unreal error 1.png (45.2 kB)
unreal error 2.png (43.9 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Ok lets see.

  1. So for the missing TickEvent Messages: Are you sure you spawn GrapplingHook2 and not something else like GrapplingHook1 or so? Or do you disable the TickEvent at spawn for any reason?

  2. If you say collision with another Projectile: Do you want the GrapplingHook to react to Projectiles or even attach to them? Perhaps you want to set up collision to ignore others.

  3. About your error messages: Does your GrapplingHook already work with the surfaces? Because the Message just says it wants to attach to itself (would form cycle) and not to the surface you probably want to. How does your collision handling look like?

You can also check out this tutorial to get some ideas (for collision handling and so): https://wiki.unrealengine.com/Grappling_Hook_Tutorial

This thread also handles some problems you probably will run into: https://answers.unrealengine.com/questions/108664/how-can-i-make-a-grappling-hook.html

hth :) Marooney

more ▼

answered Jul 22 '16 at 05:38 PM

avatar image

891 36 8 37

avatar image SpartanBeef Jul 24 '16 at 02:22 PM

Ok, so I solved it. It turned out that I was indeed spawning another projectile called grappling hook 1 when I should have spawned grappling hook 2. Stupid mistake.

Thanks for the links and the help.

avatar image Marooney Jul 24 '16 at 05:44 PM

Well, yep, that is why programmers usually need so much coffee :) Please check the answer as solved (on the left side below the arrows) to close this question for the answerhub-system and the people who are looking for unanswered questions :)

(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