Indicator point to target object
Hello Unreal friends!
I'm more comfortable with the art side of the engine, so I always struggle with stuff like this - any help would be lovely!
I'm prototyping an arrow (mesh) that will appear above the players head and point to the objective. I have a working version of this, however, the problem is that the target that I would like the arrow to point toward can only be set in the level by making a selection:
The problem with this is:
Here's my current blueprint for the indicator arrow:
So - I'd like to get the world location of my Game Ball mesh but that's located in it's very own blueprint. I have no clue how to retrieve it's location and, even if what I'd like to do is possible?
Any thoughts on this? Thanks so much in advance!
asked Jan 02 '19 at 06:42 PM in Blueprint Scripting
If using Get All Actors of Class, you would pick the specific class/blueprint that your Game Ball uses. If using Get All Actors with Tag, you would need to add an identifying tag to your Game Ball blueprint and type that in to direct the search.
Both of these nodes return an array of actor references, regardless of how many matches they find (even if it's just one match). So you'll have to loop over the array, or pick a specific item from it (probably index 0, the first match) to access the one specific Game Ball actor you want to point the indicator toward.
Also, whichever node you choose, I suggest calling it up during the BeginPlay event, and storing the found Game Ball actor in a new variable. This way, you only need to call up the search function once, which helps with efficiency. You'd then have an Actor variable that you can subsequently access anytime you need to update the indicator's rotation to match the ball's current (and presumably always-changing) location.
Finally, speaking of updating, in your attached screenshots, I think you've made a mistake by connecting the look-at logic to the "Construction Script" event node. This only gets fired once, when the object is constructed. It seems to me that this look-at update logic needs to happen every frame, so you'll probably need to hook it up to the Tick event instead.
Hope that makes sense!
answered Jan 02 '19 at 07:16 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here