As I said before, the next improvement is to let the system to visually tell you when you put a brick in a wrong/invalid position.
It does not have much mystery, I change the texture of the preview for a red one when there is a collision and voila:
Much better. Now it is easier to understand what's going on.
After this we can focus on the main mission: Being able to place blocks below others.
If we wanted to do it 100% right, (cover all cases), we would have to take into account the connectors that the 2 blocks have, to know if one has a bottom and the other a top.
Seems a complex thing to do, so we will opt for something that will work in at least the simplest cases.
The current structure of a block is:
The model and, as a child, the GridStuds that it has.
To know each GridStud dimensions I simply put it in its name and then I parse it.
Given that we will always interact with at max 1 block (in terms of determining its studs / using them), I think it is a very optimal approach although it makes accessibility to that data a bit difficult.
Well, how do we make the GridStuds system we already have compatible with bricks that plug in from the bottom?
I have already commented on the perfect way to do it, now I comment on the one I have done:
The only difference between connecting a block from above or below is the height of the pivot point.
We just need to subtract the height of the block that we want to connect below and voilà.
To know when to do this subtraction, we must be able to differentiate between a top GridStud and a bottom one. So expanding the name to Bottom should suffice:
Luckily when making the data model of each brick we annotate it's height :)
Thanks to the scheme that the name followed until now, i don't have to fix more than 1 line of code; as in all places the studs were detected looking if the name of the object began with GridStud. Something that has not changed:
We fix the point where the stud's name was parsed and it should be ok to go:
At this point I don't really know what to do next.
- Find out how to make the detail of the brick breaking when breaking it
- Look at the graphics parts, see if I can make them more cartoon and if it looks good
- Look at the lighting part, I really don't know if it's the graphics or the lighting that gives it a gloomy look instead of "lively" / "alive".
- Add hundreds of bricks models
- Make it multiplayer.
Before adding hundreds of bricks, I think multiplayer must be implemented, since it will surely involve retouching the ones we already have in some way or another.
So far I've had enough for today.