In game shape recognition

Hello there,

So I’m working on this school project where we are building a game for kids.
It is a building experience where kids have to build a requested shape in 1 by 1 units.

I am having trouble wrapping my head around how to construct the system that makes sure the shape is built correctly.


As seen in the picture above my prefab consist of a floor element which has four children that is attachment places.

What I am imagining is that I can track the shape through which attachments get blocked.

Looking at an L shape we get the following:

Depending on from where I build my first unit and on the pattern can vary. In the case of the L shape, there are four possibilities where 0 is the first base unit:
![0 3 3 3
4 0 3 3
4 1 4 1 0 1 2 0][2]

The stranger the shape the more cases to track for, how would I go by this in the smartest way and make a system that doesn’t have the shapes hardcoded in? I hope my question makes sense. A pseudo-code example would be very helpful.

Thanks!

Hey! I know this is a late reply, but you can and should check this subreddit post, which is somewhat similar to your thingy.

Here is the link : Reddit - Dive into anything

Enjoy :slight_smile: