CsgCombiner¶
Class ยท server and client scripts
CsgCombiner combines child parts into one union or intersection that Csg creates. Its parts stay inside it. Moving or resizing a part inside rebuilds the combined shape, while changing the combiner's Size stretches the result without a rebuild.
Example
-- Server script in a wall part: cut a doorway and paint the wall white.
if self.Body then self.Body.Motion = "Static" end
self.Size = Vector3.new(12, 8, 1)
local doorway = World.Spawn({ Shape = "Box" })
if doorway.Body then doorway.Body.Motion = "Static" end
doorway.Size = Vector3.new(4, 7, 2)
local pos = self.Position
if pos then
doorway.Position = pos
end
local wall = Csg.Subtract(self, { doorway })
if wall then
wall.Color = Color.new(1, 1, 1)
end
Operation¶
Operation is "Union" or "Intersection". A union adds its positive parts together and cuts out any child with CsgNegative; an intersection keeps only the volume every positive part shares.
UsePartColor¶
UsePartColor draws every face in the combiner's own color and material instead of those of the source parts.
Collision¶
Collision sets how the combiner collides. "Default" gives an anchored combiner its exact shape and an unanchored one a convex hull per separate piece. "Hull" uses one convex hull around the whole shape, and "Box" uses the bounding box.