Spawn Actors According to Texture or Shape

I’m wondering if there’s some way to blueprint up some sort of spawner which takes in some texture or shape information as input and places actors according to that data? For instance, if I have this image (or something similar)

I’d like to spawn one actor in each black dot. Or, if I feed in a shape like a triangle or square, or some irregular shape, I’d like to best fit x actors into that shape. Either solution would suit my needs.

Right now I am able to spawn as many actors as I’d like using an array of transforms I set by hand, but it’s tedious to create shapes like that. I am hoping to extend this functionality one of these ways. I am open to any other suggestions to reduce this tedium.

Hi there,
It is perfectly doable in UE.

For the black dots, look for a procedural grid generator, as you want different shapes randomly generated in your level. Also, every shape can be an actor blueprint that contains a Boolean variable (is empty?) so you can track available spaces, and another variable identifying its current shape.

For the actors, you can use a shape variable that can be a type of enumerator (list), integer, name, Texture 2D, or anything that helps identifying the spawner actor and its shape.

And you may want to create a “slot manager” logic, in a form of an actor blueprint placed in the level, the player itself, or the game state, keeping track of all available spaces as well as the player score whenever both shapes match or not.

1 Like

You can spawn where it’s black, using

3 Likes

I marked this as the answer in case anyone else wants to use this, but I ended up exporting the positions to JSON using a python script and importing it into unreal by parsing the json in a c++ class. Seemed to be the less finicky option for the exact thing I wanted to do. I appreciate the answer!

1 Like