How to make a building system place things underground?

So, I used this tutorial on a simple building system. I have been playing around with it, trying to learn about it. But i have a question, how would you make an object go underground? Obviously, the “preview part” (the part you see before you actually place the object) has to stop when it sees a part or something so it can place on top of things, so couldn’t you just lower that for certain objects?

I have tried to use Mouse.TargetFilter = workspace.Baseplate, and put another part under, but that makes the preview part go toward the camera.
i also noticed that cancollide set to false allows for the part to go through, but I dont want players falling through the ground tho

1 Like

You could simply lower the Position

I forgot i could move the main part up… my bad.

this also makes another problem that i forgot would happen.

is there any way to cut pieces of a large part out when a model is there?
for example, i have this trench i built quickly to test with, but when i put it in the ground, the baseplate obviously will just fill it in.

image

is there any way to stop this at all?

What do you mean by that?

Ok so basically i have this trench model that when you put down goes into the ground, like i wanted it to.
image
but when I spawn it, the ground covers it and you are not able to go in
image

is there any possible way to stop the ground from covering up the trench, and make it open to get into?

Only way I think this is possible would be by dividing the floor into chunks that are singular parts, and when you add the trench destroy the part (very hard, I know)
Or if it’s even possible use Unions

1 Like

yeah, and unioning is possible but its very difficult and its high demand resource-wise

1 Like

Using Collision Filtering might solve that problem like a pro. Mouse raycast’s respect collision group’s filters.

Use SubtractAsync on the part to make it a union. It will crash after you put 50-100 of those down though.