Perlin Worms for Caves

So, I have a perlin noise terrain generator, alongside a perlin worm. Just wondering how to remove anything touching the parts created by the perlin worm. It is anchored so .Touched() wouldnt work.

4 Likes

Touched will still work for anchored parts.

6 Likes

What are you trying to remove?

3 Likes

The terrain, they are 4x4x4 blocks and im trying to make caves

2 Likes

Both the parts are anchored, and their positions are set as soon as they spawn in.

2 Likes
game.Workspace.Terrain:FillBlock([PartPos], [PartSize], Enum.Material.Air)

Terrain cannot be detected with the touched event, so this is what you are looking for. Here is the documentation for Terrain:FillBlock(). This method replaces all the terrain touching a specific part with whatever you have the material set to, which in this case is air, because you want to delete it. If you read the documentation you can do this with spheres and other shapes, too.

3 Likes

I played with this a couple months back and what I did was created the worm part and then called the GetTouchingParts on that new part and looped through all touching parts and destroyed them.

1 Like