Attach array of actors to another array of actors

Howdy!
Well, i have a Spawn Volume that spawns randomly meteors all arround the spawn (its a spaceshp universe so there’s no floor) and you have to shot the meteros and destroy them, pretty simple.
The thing is that i want to add the life of the meteors, so you can see how many bullets do you need to destroy them.
I’ve done this adding a widget into the meteor actor and update every time that the players looks at it, or shots, but its kinda annoying because the widget rotates randomly with the meteors (so, sometimes the hp bar is inside the meteor looking at you, or in a side, or behind, or you just can’t see it… )
And what i want to do, is have this hp bar just up in the meteor, looking at you, but i can’t create this into the meteor bp (i think) because it will rotate.
What i’ve done this far, is create another actor, which is only a widget, and try to spawn it the same times as the meteors, and then attach them into the meteors… but is not working, and i think im messing up this.
Thank you!
And sorry for my english, its not my native lenguaje!

Adding a widget component to your meteor BP or attaching an actor with only one widget component to your meteor BP shouldn’t make any difference. I would try to update the widget component world rotation at the tick event of the meteor BP. I don’t know the local directions of your widget (i.e. is the x-axis point up, or right, …), but you can create a rotator out of two axis. So when I assume that the widget’s local z vector should point upwards and the x vector should point towards the player, then use the “Make Rot From XZ” node, plug in the global Z vector as Z and the player’s world location minus the widget’s world location as X, and use the rotator for Set World Rotation Of Component for the widget. I hope this helps.

That is what i have from the BP meteor, this is inside the function ‘‘Follow character’’ which is called with the event tick only when its created.
I think i know what you mean but i don’t know how to do it.

Does your function not work? I’m afraid I don’t understand the problem.

Its working but not the way i want, i want to have a hp bar for each meteor that stays at the top of the meteor and does not rotate with it. So, i was thinking about creating another blueprint, and ataching every one to the meteor blueprint… or something like that

That’s why I suggested to use the Make Rot From XZ node. In addition set the world position based on a predefined relative offset, like this:

That’s just a new variable I created for this actor.

okay i’ll try this and let you know.
Anyway, what’s exacly the ‘Health widget world offset’ variable?
thanks

You should try to see the results by using only a Widget and screen space. There are two ways to tackle this.

The first one is by simply using your main HUD class. Get all the meteor actors and project their world location to screen location so that you get the location in screen space where you will draw their health bar. You can additionally filter by their position on the screen so any meteor that is not on the screen will be left out. You could also move the health bar above the meteor (in your case in screen space since they’re rotating in world space). Example:

The second is a bit more complicated. You should create a separate Widget that will contain the health bar itself, and then in a similar fashion spawn it above the meteors, but this time from your main HUD widget. You should create a canvas element that has full screen size in your main widget and then on construct spawn the health bar widgets and parent them to the canvas. The health bar widgets should have an actor variable (could also be meteor) that should be passed on spawn, which will be the connection between the widget and the meteor actor. Then in the health bar widget on tick just take the actor location project it to screen space and translate the health bar element to that position. You could also filter this position as it may be off screen.

I haven’t tried this yet on this specific example, and I don’t have the time now, but it has worked for me in the past. If you can’t figure it out by yourself I will post a blueprint screenshot later.

what kind of?

I tried this but it doesn’t seems to work, my ‘draw text’ is different compared to yours, i’ve been trying and i dont know how to solve this

There are 2 types of DrawText you have to get the one where the target is HUD.