My problem is a bit hard to explain, which makes it difficult to search for a solution to.
I want to click at location A to define one corner of a room, then click at location B to define the opposite corner, and have boxes spawn in a grid using the two points.
I already have a blueprint which spawns a building made up of small squares creating the roof and outer walls when the game starts by attaching the roof actors to eachother in a loop and adding them to an array. I can also place a single box anywhere within this building to create a 1x1 room there, which will create walls around itself using line traces, if there is any roof next to it.
This is the building within which the player can build rooms. The small room inside was built in-game one square at a time. I’ve selected a few roof and wall actors to show them better.
This is the bit of the blueprint which spawns the bottom row of roof tiles, from right to left, until it reaches 50 tiles. It then continues to the next loop which spawns tiles in a column, and then another which fills out the rest.
I think the same system could be used to spawn a room between point A and point B, but I’m not quite sure how to go about it. If the player clicks point A, then moves the cursor to the right, boxes should spawn between A and the cursor, and if the player moves the cursor up, boxes should spawn from that bottom row of boxes and upward to the cursor, creating a square of boxes to form the room. Once the player left-clicks again, the boxes would be placed (that part I’ve already got figured out). I’ve got a snap to grid function in place as well. I guess what I’m lacking is a good way to track point A and the cursor.
Something like this.