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:
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:
What technic should I use to decide which attachment is the best to use to snap onto?