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”.
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.
You need to get a component from your target actor and set that as the homing target.
And how do I do that? Sorry, noob here.
Been there done that! I have the most recent comment there!
It uses a first person shooter game, and he has to select each object he wants to target later. So the actual target is set by the player. I want this to be automatically activated for the target.
Case 1: “target not present in level” - player fires, throws, whatever, the projectile goes where it is supposed to as per specified in it’s settings.
Case 2: “target spawned in level” - player fires, and projectile automatically goes and hits this target.
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.