It was requested to be able to align and maybe distribute any selected actors, similar to every align and distribute tool in every graphics program that has them.
I’ve managed to work out a distribution functionality along X and Y (Z positioning is never an option). I’ve also managed to get an alignment for their centered positions and their +/- Y boundaries, based on selection.
I recycled the blueprint script for the +/- Y boundaries to use in the +/- X boundary alignments.
That’s where I start having problems. The actors align based on the furthest most actor in the X direction they’re aligning to, however it doesn’t appear to be aligning to the actual x bounds.
I’m performing the following steps to get any alignment, for simplicity sake i’ll focus on the -X direction:
- Retrieve all -X coordinates from GetActorBounds
- Determine which -X coordinate is greatest with MinOfFloatArray
- Move all actors to the max -X coordinate plus their individual -X bounds.
You can see the actual blueprints in the attached images.
This should give me the desired result, however, you guessed it! The actors are not flush with each other.
I’ve considered that the actor bounds may be pulling from information that isn’t the static meshes. This would be fine, except when aligning a second time to the same side the actors give varied results. They’re not even consistent.
At the moment, aligning in the -X direction as described above creates a caterpillar effect where the destination actor is the destination for the other remaining actors; Then the roles are reversed, where the original destination actor aligns to the other actors. this repeats indefinitely so long as you continue to try to align in the -X direction.
For clarity, this method works with the +/- Y alignments, so I’m not sure why they’re not working for X.
Is there maybe something I’m missing or am I approaching this completely wrong?