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.
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?
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?
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.
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?
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.
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):
This thread also handles some problems you probably will run into:
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.
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