PcoWSkbVqDnWTu_dm2ix

Understanding Assemblies

Understanding Assemblies

10 min

BasePart|BaseParts are a deceptively simple instance. They are literally the “building blocks of Roblox” and have a myriad of customizable properties that can seem overwhelming. This article outlines parts as physical bodies and how they work together.

Overview

At the simplest level, a BasePart is a piece of 3D geometry that has a position and orientation defined by its datatype/CFrame, as well as a size.

An assembly is one or more BasePart|BaseParts connected by rigid WeldConstraint|WeldConstraints or Motor6D|Motor6Ds (animated rigid joints).

1 assembly; 1 part
1 assembly; 18 parts
1 assembly; 179 parts

An assembly is considered a single rigid body in the physics engine, meaning no force can push or pull the connected parts from each other and they will move as a single unit. All forces applied to a specific BasePart are applied to its assembly — for instance, when BasePart/ApplyImpulse is called, it takes BasePart/AssemblyMass into account and applies the impulse to the assembly at the BasePart/AssemblyCenterOfMass.

Assembly Properties

The following BasePart properties show data regarding its assembly. Their values will be the same for any part in the same assembly, so it doesn’t matter which part you use.

Property Description
BasePart/AssemblyLinearVelocity|AssemblyLinearVelocity The linear velocity vector of the part's assembly. Setting the velocity directly may lead to unrealistic motion, so usage of a VectorForce constraint is preferred, or BasePart/ApplyImpulse|ApplyImpulse for an instantaneous change in velocity.
BasePart/AssemblyAngularVelocity|AssemblyAngularVelocity The angular velocity vector of the part's assembly. Setting the velocity directly may lead to unrealistic motion, so usage of a Torque or AngularVelocity constraint is preferred.
BasePart/AssemblyCenterOfMass|AssemblyCenterOfMass A read-only position calculated via the mass and position of all the parts in the assembly. A force applied to the center of mass will not cause angular acceleration, only linear.
BasePart/AssemblyMass|AssemblyMass The sum of the BasePart/Mass|Mass of all the parts in the part's assembly. If the assembly has an anchored part, the assembly's mass is considered infinite.
BasePart/AssemblyRootPart|AssemblyRootPart The part automatically chosen to represent the assembly's root part. See Assembly Root Part below for more details.

Assembly Root Part

Every assembly has a root part indicated by its BasePart/AssemblyRootPart|AssemblyRootPart property. You cannot explicitly set the root part, but the following factors affect probability:

highest probability
lowest probability
An BasePart/Anchored|Anchored part will always be assigned as the root part. Parts with BasePart/Massless|Massless property of false (default) take precedence. Higher BasePart/RootPriority|RootPriority values take precedence. Precedence based on the part's size, with multipliers for parts with specific names.

Root Part Anchoring

When one of the parts in an assembly is anchored, that part becomes the root part and all of the other parts become implicitly anchored with it.

  • Below, four parts are welded together with WeldConstraint|WeldConstraints (green bars) to form a single assembly, as indicated by the matching colored outlines.
Four parts welded to become a single assembly
  • If just one assembly part is anchored, the assembly will not change, other than the root part potentially changing (the anchored part has the highest priority for becoming the root part).
Anchored part (left) becomes the new root part
  • If more than one part is anchored, the assembly will split. Here, both the left and top parts are anchored, so the original assembly splits into two assemblies as shown by the colored outlines. Also, the WeldConstraint between the two assemblies deactivates, since you can’t have an active weld between two anchored assemblies.
Two assemblies with anchored parts as the respective root parts
Tags:
  • assembly
  • root part
  • rigid body
  • physics