SubtractAsync
This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
For thread safety, this property is not safe to read in an unsynchronized thread.
SubtractAsync creates new UnionOperation which occupies the same space as the part minus the space(s) occupied by the parts in the given array. It does this by invoking the real-time CSG solver. Similar to Instance/Clone|Clone, the returned object has no Instance/Parent|Parent set.
The following image depicts an example of a SubtractAsync operation: the yellow part on the left has SubtractAsync called with a table containing the two pink parts. The resulting UnionOperation is moved to the right, as it would otherwise overlap the original part and not be visible. Notice the missing concave pieces that match the spaces once occupied by the pink parts.
local yellowPart = workspace.YellowPart
local pinkParts = {workspace.PinkPart, workspace.PinkPart2}
local union = yellowPart:SubtractAsync(pinkParts)
union.Parent = workspace
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
|
|
The objects taking part in the subtraction |
||
|
Default
|
The value of |
||
|
Automatic
|
The value of |
Returns
| Return Type | Summary |
|---|---|
|
The resulting union from the subtraction operation |