Does this also mean that we will be able to create and set meshpart mesh ID’s soon too?
HOLY SMOKES
This is an awesome birthday present
It appears if you stop a simulation while UnionAsync or SubtractAsync is working, you can cause something to crash - Studio will throw up the “unexpected error occurred” dialog.
Studio will continue to work fine but will close if you click OK. If you ignore this dialog and attempt another simulation, these functions are dead and will no longer work.
Start a simulation and stop it again roughly one second after the first negate happens.
Baseplate.rbxl (13.6 KB)
thanks, I’ve created a ticket for this.
Don’t know how optimized this is yet but bullet holes can finally be a thing.
For those with problems using the new API, it creates a new Union object and doesn’t change the original parts.
local newPart = Origin:SubtractAsync({Part table to subtract}, Enum.CollisionFidelity.CollisionFidelityOfChoice)
newPart .Parent = workspace
YES, THE GODS HAVE ANSWERED US! I have to have a complete sentence to post :/.
OH, SO MANY POSSIBILITIES
YES!
This will make so many things possible!
I’m excited to try it!
y e s
I must say, I felt really negated without this feature. I’m glad you guys unioned up to create something so awesome!
Seriously though, I remember a few years ago when something like this was unthinkable with CSG.
This update is much appreciated and will definitely be very helpful with making games feel more realistic.
WOO! Finally! This is going to be a game changer, I just hope it’s very optimised on a larger scale. If not, that’s perfectly fine.
Here’s a code sample that I wrote for in-game CSG a few weeks ago.
It makes explosions carve spheres out of nearby parts!
----------------------------------------------------------------------------------------------
-- @CloneTrooper1019, 2018 <3
-- SwissCheese.lua
----------------------------------------------------------------------------------------------
local function createRegion3FromPart(part)
local pos = part.Position
local size = part.Size
local corner0 = pos - (size/2)
local corner1 = pos + (size/2)
return Region3.new(corner0, corner1)
end
local function onExplosion(explosion)
-- Ignore visual-only explosions
if explosion.BlastPressure == 0 then
return
end
-- Create the sphere that will be subtracted with this explosion.
local radius = explosion.BlastRadius
local negateSphere = Instance.new("Part")
negateSphere.CFrame = CFrame.new(explosion.Position)
negateSphere.Size = Vector3.new(radius, radius, radius)
negateSphere.Shape = "Ball"
-- Cast negateSphere into the 'Objects' type.
local subtractor = {negateSphere}
-- Capture the parts within a Region3 formed by the sphere.
local region = createRegion3FromPart(negateSphere)
local parts = workspace:FindPartsInRegion3(region)
for _,part in pairs(parts) do
local success, result = pcall(function ()
return part:SubtractAsync(subtractor)
end)
if success then
-- Move the children of the old part into the new part.
for _,child in pairs(part:GetChildren()) do
child.Parent = result
end
-- Swap out the part with the union.
result.Parent = part.Parent
result.CFrame = part.CFrame
part:Destroy()
else
warn("SubtractAsync failed because:", result)
end
end
end
-- Listen for explosions being added to the workspace
local function onDescendantAdded(desc)
if desc:IsA("Explosion") then
onExplosion(desc)
end
end
workspace.DescendantAdded:Connect(onDescendantAdded)
----------------------------------------------------------------------------------------------
How often does real time CSG error compared to CSG in studio?
I’ve been wanting something like this for years. Thanks for the early release.
A developer @Lauri9 (view roblox profile) has worked on a quick demo, using this, which took only 3 hours(!!) to code and the results are promising!
AMAZING, I can’t wait to see what people do with this.
ive literally just made my entire map destructible i thank you