I have a script which randomly generates underground rooms in a BasePart
using the SubtractAsync
function. It works perfectly fine, however the CollisionFidelity
is inaccurate, leading to me being unable to enter the rooms.
Here is the code:
[...]
for _,i in workspace:GetPartsInPart(p) do -- Gets parts to be cut into
local succ, err = pcall(function() -- pcall ignores part if it cannot be cut into (none of the parts I have with models need to be cut into)
local fi = i:SubtractAsync({b.RemoveFromTerrain}) -- Cuts
fi.Parent = i.Parent -- Replaces part with cut part
i:Destroy()
end)
end
[...]
Note that despite being quite slow, if I can get it to work, the performance loss I would suffer from using SubtractAsync
would be worth it in my case.
I have tried the following:
CollisionFidelity
in the script after the Union was created -> cannot set because no (The current thread cannot write 'CollisionFidelity' (lacking capability Plugin)
)CollisionFidelity
in Studio on the part I'm cutting into -> BaseParts don't have the CollisionFidelity
propertyAs read in the documentation the second paameter in the SubtractAsync/UnionAsync is the collision fidelity
collisionfidelity: Enum.CollisionFidelity The Enum.CollisionFidelity value for the resulting UnionOperation. Default Value: "Default"
So use
local fi = i:SubtractAsync({b.RemoveFromTerrain}, Enum.CollisionFidelity.PreciseConvexDecomposition) -- Cuts