Unique reference to actor components (embedded static mesh)

Say I dynamically spawn actors into a level.

I grab their dynamic names into an array to use as references.

I now want to refer to their components (for each unique instance of the spawned actor) - the components are embedded static meshes which help determine which side of the actor is facing up.

When I grab the component names (by tag) into another array I find that all the component names are the same - for each instance of spawned actor.

Eg say I dynamically spawn an actor - it spawns as name10 and name101 if I spawn 2 of them.

But their components are the same when I grab them into an array - say the component was called “max” - i expect to see a max10 and a max101 - but i only see the component from the actor blueprint “max” - not the spawned instance.

How do I get a unique reference to each spawned instance components?

How do you calculate which side is up and why can’t you use an entire actor to do so?

Detailed Answer:

What i did was run a get world location on each embedded static mesh component, using the reference from the blueprint actor.

In the same blueprint, i start the execution chain(on event begin) with a reference to the dynamically created actor (get all actors of class to access array with dynamic actor name) , which then does a velocity check on the specified instance of actor, and only if the velocity is 0 goes to the check described above - to check each of the meshes to see which one has a higher z value. That is done by the get world location but this is where the problem is, that i am using the references from the original actor as the inputs into those checks. This results in ALL instances of the actor being checked, not just the one referenced dynamic actor. (there are 2 in total in the world). I expect to see two sets of values for Z for one instance of actor (one for each embedded mesh), but i get 4 when i print to screen.

I expected 2 that because this chain started by first getting the dynamic actor reference, that the get world location checks on the meshes would be within the context of the dynamically spawned object, not on ALL instances of the spawned object.

Reason for my expectation was that after the mesh checks, I execute the set view with blend using the dynamic actor name and it goes to the correct one of the 2 actors in the world.

This actor fyi s a coin that spawns mid air and drops to the ground. It always starts same up (heads) at spawn.

I’m new to UE4 so i’m doing this calculation the most obvious way i thought but theres probably a better way to go about calculating relative rotation from spawn to settling on the ground?

So there are only 2 possible final positions. That’s simple. Just check the actor Up Vector. If heads is up, the Up Vector will be (0,0,1), if tails is up – (0,0,-1). You don’t need additional meshes to do that.

Edit: it’s possible that the actor up vector isn’t always precisely vertical. You can check the actor Up Vector against the world up vector using dot product.

wow ok i didnt know these things exist, until now. im just literally one week in.

will do some research on these and try them first thing in the morning.

many thanks.