Plot building system like Lumber Tycoon 2

I am currently making a plot-building system and I want to be able to place parts on the side of others. With my old script, whenever I clicked on a wall, the part I want to place would stick half of itself in the wall since I set its position to the mouse’s position.

I had another idea to put attachments on all sides of the part and use one of them as a reference point by detecting which surface (front, back, left, right,…) of the wall my mouse is on.
Eg:

The problem with this method is that if the wall or the part is rotated, the surface does not face the same way. This is because I am using a mouse.TargetSurface.Value to have the side of the wall that my mouse is pointing at and then use one of the attachments as the parts pivot point.

Anyone would have another idea or method to offset a part on any surface so it sticks on a wall rather than clipping through it?

Here is an example of how it SHOULD WORK (LEFT) and how it works when the wall has an orientation different than (0,0,0) (RIGHT)

I want it to work like the right wall on every wall even if they have an orientation. Any ideas or different methods that you guys would use?

I just realized that LT2 has the exact type of building script that I want. Does anyone know how their method works so well?

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