Homing projectile to a single target
Hi. Here is what I want to achieve, and here I am, bloody stupid, because I can't set it up. I have a third person "shooter" game, where the main character basically throws a rock. (school project). If there is a single target (there will be only one target at a time) the projectile should hit this target (if other conditions are met, but that's not the issue now).
For my life I could not feed a proper value for the "Homing Target Component".![alt text]
On the screenshot, there is the target, which will be spawned on the map at some event, and then the main character has to hit it with the rock.
Any help please? this is kinda a mission critical aspect of the project, and here I am dumb-folded.
cheers : /storage/temp/109221-capture.png
You need to get a component from your target actor and set that as the homing target.
answered Oct 01 '16 at 05:49 PM
Given that this was back in October, I'm going to assume this issue is either resolved or no longer a primary concern for the school project, but I have an answer to your question regardless.
In blueprint there's a node called "Get All Actors Of Class", which gives you an array collection of all actors of that type in the scene. Set it to your enemy actor class, and drag off the return node (the little array square), choose "Get" node, and leave it at index 0. This will give you a reference to the first (and according to your scenario, only) enemy in your scene.
From there, you drag off of that enemy actor reference, type in "get" again, and at the bottom will be a section of components for that enemy, such as the capsule collider. You can then plug that component into your "Homing Target Component" for the projectile movement.
That said, I'm still trying to figure out how to make the projectile properly home in on the target myself, which is what led me here.
Best regards and best of luck to you. ^_^
Edit: Figured out where I messed up the homing part. If the Projectile Movement's "Max Speed" is at 0, it can infinitely accelerate, making the homing inaccurate, tending to over-shoot. Make sure there's a Max Speed value for homing projectiles, somewhere around 3000 - 5000 is working well for me.
Follow this question
Once you sign in you will be able to subscribe for any updates here