I’m working on a project right now where you can spawn units (like back in the battleforge days) somewhere in the level. I made a SpawnerToolBase blueprint and a BaseUnitClass blueprint.
SpawnerToolBase: Stores data like class to spawn, amount to spawn.
SpawnerToolChild: Inherit from SpawnerToolBase, for each type of unit placement i want to use (e.g. 10 Archers or 4 Mines)
I get them to spawn with a fixed/random offset from the mouse position in the world. (Line trace from mouse pos to the ground)
I want to make it more generic. I want to calculate the offsets dynamically. So if i place 10 units i want them not to overlap and look the same everytime i use this specific SpawnerToolChild.
Because of the dynamic unit count random is not a solution.
Could anyone please give me a direction how i could achieve my goal?
Due to the fact i’m not a native speaker i tried my best. Sorry for any mistakes.
Thanks in advance.
Edit1: Made a circle with a specific radius, cut it into pieces by the amount of units to spawn (360/x) and then used COS(deg), SIN(deg) multiplied by radius to get the solution.