Ahh! Super cool looking Tri!
I hope you keep posting more, I'm pretty fascinated by this
Could I ask how you're doing the grid selection? And then building everything inside of them?
-craigz
Hello craigz,
Here's a small summary to answer your question.
Could I ask how you're doing the grid selection?Requirements: Vector3, 3 floats variables
Actions: Mouse Pick, Get Vector3 XYZ, Set Vector3, Float Round to Nearest
Summary: Basically I set it so that when I use the mouse click the first time, I take the pick location as a Vector3, after that I break it down into float values for the X, Y, and Z axis, afterward I reassign it to the first vector variable. From there if you want to keep that value then you just have to use another v3 variable and save it.
And then building everything inside of them?Requirement: Array List, A lot of math.
Actions: Mostly just Create Advanced Game Object
Summary: This is actually quite complex so I'll try my best to explain it, I'll just explain how I got the Floor to work and the rest is just an expansion of it.
First you need to prepare the Tile Prefab. I use a square and made sure that the pivot point is at the corner of the square.
Then you need to do a lot of math... so using the grid picking FSM I made, I managed to find out the Volume of the area that I picked (Pick the first v3 and then add it to the second v3 and get the volume, I used an Absolute value here incase the vectors are negative)
So knowing the volume will help me get the size of each of the side of the "Building", let's use 3x3 in this case (Since I'm only going to explain about the floor, we don't need the third value)
I set up a Manager object which calculate how many tiles i can fit in a 3x3 and then with Array List, I save out all the positions that the tile can go.
For example, the first tile will be at 0,0
The next one will be 1,0. Then 2,0. Then the x axis resets and I add 1 to the y axis. so 0,1 1,1 2,1 and it goes on until i get all the Transform position.
After that it's the easy part:
- Create empty gameobject at picked location, renamed it to "Group"
- Create Tile Prefab as a child object of "Group"
- Use get next arraylist action to get the Transform and set it to the tile
- Repeat until I instantiated all tiles
If you are interested, I added my very first flowchart that I made for this prototype, it has some mistake in them but it is the general flow of how I made this builder.
https://sites.google.com/view/omgitstri/prototypes/wip-builder?authuser=0