Building System Help

So I am designing a plot building system:

On the client-side, while the player decides where to place a part, I want an algorythm to choose what is the best place to place the part.
Here are some examples:
image

As you can see I am currently just setting the ghost-parts position to the mouses position.

I had the idea to place 8 attachments on the part to decide which one to use as reference but I still dont know how to detect what would be the best placement.

The image shows a wall and me trying to place a part on it:
image

What technic should I use to decide which attachment is the best to use to snap onto?

Is there a way to detect on which side of a block we are looking at?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.