I’m trying to move an array of static meshes from point A to point B to construct a wall in a certain order. On begin play i get an array of transforms of the final locations for each brick part to move to, (as I have constructed the finished wall in the blueprint viewport). Then i want to randomize the location of the bricks on the ground. I’ve tried moving the parts to a random location within a spawn volume, but sometimes (as each brick needs physics turned on from the start) they collide and explode everywhere.
As my blueprint is a template where the brick sizes could vary wildly, and they’re location will be random at the start of the level, i could do with a way of trying to adjust they’re location, but make sure they always spawn, like Spawn Actor does. But i don’t want to start spawning classes of Static meshes for every brick if that make sense.
yes the bricks will be kicked about. a bit like a Lego build it. At the moment i am using a SetRelativeTransform on the array of bricks, with Sweep and Teleport unticked
Basically, the player walks into a volume, holds a button down and the parts move into place. when the button is pressed i get an array of current transforms, so i know where to move them from and to. after a brick has finished moving to its final location it no longer had physics set on it.
Its just the placement, or spawning of the bricks on the ground i’m having trouble with.
I thought maybe i could have 2 sets of bricks in the blueprint, one where they have constructed the wall, and one set where i have more control of them and can place them how i like on the ground, but that would be time consuming.
Ok I am just trying to think out of the box here, if the whole wall was to move and then “collapse” what you could do is have a wall mesh. on that mesh add sockets for each brick, then what you could do is move that ONE mesh, and after it is moved, you can spawn an actor from each socket whilst simultaneously destroying the main wall actor, so it will look like the wall falls apart?
You can even spawn individual brick actors from that array, and give the socket a name relevant to the individual brick actors, and it wont spawn an actor unless it matches the socket name?
so an array of socket “names” and an array of the bricks objects. add a tag to the bricks and match the tag to the socket name array entries
Thanks. Theres some interesting ideas there. The issue with the collapsing wall is that the individual brick meshes may not necessarily be anywhere near the final constructed wall mesh at the start of the level. However using sockets is a really good idea. I tried using a skeletal mesh originally, but i couldn’t get an array of bone locations in blueprints. This would have saved me some time as i could have just exported 1 skeletal mesh from Maya. Currently i have to export every brick piece manually and reconstruct the completed wall manually in blueprints.
As the brick pieces are all different sizes and the wall is constructed in order from the ground up, id need to create sockets and name them corresponding to the brick names, as thats what i’m using to sort the array into alphabetical order.
I guess i could manually setup all the sockets for the final locations with corresponding names in the blueprint, but with a wall of 30 pieces thats gonna take some time.
EDIT, i think i misunderstood your first paragraph. I’ll give it a try, thank you.
So ive done a quick test with 3 brick pieces and i’ve got it to work. I made 3 scene components, tagged them with Final, and named them alphabetically in line with the static meshes. On Begin play i made a new array of the scene components, sorted them alphabetically and got their transforms. This gave me the final location for the bricks, and i was able to move the static meshes anywhere in their unbuilt, physics on, resting position in the level.
Although this works, it will take some time to setup more complicated walls. I’m wondering if there is a way i could export the final wall as a skeletal mesh, and somehow on begin play create sockets for every bone, rename them according to the bone name, sort them alphabetically, then get an array of socket transforms, then delete the skeletal mesh from the blueprint??