Mechanical Constraints

*เนื้อหานี้จะพร้อมใช้งานในภาษาที่คุณเลือกในเร็วๆ นี้

The physics engine includes the following Constraints that behave as conceptual mechanical connections, including hinges, springs, ropes, and more. In addition, various mover constraints are available to exert directional or rotational force upon assemblies.

Ball Socket

BallSocketConstraint forces its two attachments into the same position and allows them to freely rotate about all three axes, with optional limits to restrict both tilt and twist
Hinge

HingeConstraint allows its two attachments to rotate about one axis, with optional assigned power for motor or servo behavior
Prismatic

PrismaticConstraint allows two attachments to slide along one axis but not rotate, with optional assigned power for mechanisms like sliding doors and elevator platforms
Cylindrical

CylindricalConstraint allows its attachments to slide along one axis and rotate about another axis, with optional assigned angular and/or linear power
Spring

SpringConstraint applies a force on its attachments based on spring and damper behavior, with an optional minimum/maximum length
Torsion Spring

TorsionSpringConstraint applies torque based on a relative angle and relative angular velocity, in an attempt to bring two axes from two parts together
Universal

UniversalConstraint ensures two axes on two assemblies remain perpendicular, useful for applications such as vehicle power transmission to rear drive shafts, robotics, and more
Rope

RopeConstraint prevents two attachments from separating further than a defined length, with optional behavior as an extending or contracting winch
Rod

RodConstraint keeps two attachments separated by a defined length, with optional limits on rotational tilt
Plane

PlaneConstraint moves two attachments into a position/orientation along a plane, and both attachments remain free to translate and rotate unless otherwise constrained
Weld

WeldConstraint connects two BaseParts and ensures they stay in the same relative position and orientation to each other, even if they are not touching
Rigid

RigidConstraint connects two Attachments or Bones and ensures they stay in the same relative position/orientation to each other, even if they are not touching
No Collision

NoCollisionConstraint prevents collisions between two specific parts, but those parts may still register collisions with the rest of the world

Constraint Visualization

To accurately visualize constraints in Studio, you can use the following options from the Model tab:

Constraints tools indicated in Model tab

Show Welds — Show WeldConstraints, separately from the visualization of other constraints.

Constraint Details — Show complete visual details of non-weld constraints.

Scale — Relative scale of visualizations.

Creating Constraints

All mechanical constraints must connect one or two Attachments or Bones, except for WeldConstraint and NoCollisionConstraint. When connected to Bones, the constraint will use their animated position and orientation.

To create a mechanical constraint, you can use either the Create tool or the Explorer window.

  1. In the Model tab, access the Create button's picker menu and select the desired constraint type, for example Spring.

    Constraint picker indicated in Studio toolbar
  2. In the 3D viewport, hover over any Part or MeshPart and click to add a new Attachment to the part at the visualized point. Alternatively, hover over and click an existing Attachment or Bone to use it for the constraint.

  3. Most mechanical constraints require a secondary attachment in their functionality, so the tool will typically prompt you to repeat the previous step on another Part, MeshPart, Attachment, or Bone.

    SpringConstraint connecting two attachments
    Completed SpringConstraint connecting two attachments

Physical Simulation

To simulate physics while moving or rotating parts, you can switch to Physical mode in the Model tab, effectively forcing parts to obey physical limitations. For example, if two parts are attached by a RopeConstraint and you drag one part around the scene, the other part will follow as the rope becomes taut.