In-Game Solid Modeling
In-Game Solid Modeling
Detailed Articles/3D Modeling with Parts|solid models can be created using the Union and Negate tools, not only in Studio but also while your game is being played. This can be used to create some truly unique game concepts.
Solid Modeling APIs
UnionAsync()
The BasePart/UnionAsync|UnionAsync() function must be called on a BasePart. It requires an array of one or more parts (otherParts) to union with the calling BasePart.
SubtractAsync()
The BasePart/SubtractAsync|SubtractAsync() function also requires an array of one or more parts to subtract from the calling BasePart.
- Color
- Material
- Reflectance
- Transparency
- Anchored
- CanCollide
- Density
- Friction
- Elasticity
- FrictionWeight
- ElasticityWeight
Basic Demonstration
Let’s test out in-game solid modeling with a quick demo script! You can copy and paste this into a Script within ServerScriptService, or wherever is most convenient.
LocalScript).
In this script, a basic order of operations occurs:
- A red glass window is created in the center of the place (lines 2-10).
- A smaller block is created in the center of the window part (lines 13-19).
- After 2 seconds,
BasePart/SubtractAsync|SubtractAsync()is called on the window, using the smaller block as the part to subtract.
pcall() to catch any unexpected errors.
- If successful, the resulting part is returned with a name of Union. This instance will not be parented to the workspace, so it’s your job to parent it back into the game world.
window) and the parts that are added to or subtracted from it (subBlock). As a result, these parts are explicitly destroyed following a successful modeling operation (lines 33-34).
Solid Modeling Playground
Now that you understand basic in-game solid modeling, experience it within a sample place.
