PcoWSkbVqDnWTu_dm2ix

In-Game Solid Modeling

In-Game Solid Modeling

5 min

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.

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.

In this script, a basic order of operations occurs:

  1. A red glass window is created in the center of the place (lines 2-10).
  2. A smaller block is created in the center of the window part (lines 13-19).
  3. After 2 seconds, BasePart/SubtractAsync|SubtractAsync() is called on the window, using the smaller block as the part to subtract.
  1. 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.

Solid Modeling Playground

Now that you understand basic in-game solid modeling, experience it within a sample place.

Rotating Windows

Blast pieces out of rotating windows or fuse new material onto them. Includes a helper module script that rebuilds mechanisms with constraints and attachments!
Tags:
  • model
  • parts
  • union
  • negate