Here you go. You can adapt it to your situation. I wouldn’t rely on GetAllActorsOfClass too much, it’s pretty intensive. But, this is a quick way to do it based on what you’re currently doing.
Just do what I did…you don’t need to do a make hit result at all… see how I linked up the location to transform?
If I understand correctly, your script spawns an actor within the bounds of another actor at a random point, correct? That’s a bit different from what I need.
Look at the picture from my OP. I have an array of actors that spawn at various locations in the level, but I only want to spawn those located within the bounds of PlayArea.
I’ve made a pawn that spawns actors at various locations from a Vector Array, and I need a way to spawn only the actors that overlap a static mesh from my level.
Edit: I’ve figured out a way to do it:
193185-
I’ve since replaced GetAllActorsOfClass wth GetOverlappingActors. That should be less intensive, right?
Can you elaborate a bit on your solution? Are you implying I should use GetActorBounds as the location of the trace in the MakeHitResult? That’s what I’ve tried, but it didn’t work.