14 KiB
| title | description |
|---|---|
| Mover constraints | Mover constraints apply force or torque to move one or more assemblies. |
import ConstraintVisualization from '../includes/studio/constraint-visualization.md' import ConstraintSimulation from '../includes/studio/constraint-simulation.md'
The physics engine includes the following Class.Constraint|Constraints that apply force or torque to move one or more assemblies. In addition, various mechanical constraints are available which behave as conceptual mechanical connections, including hinges, springs, ropes, and more.
Constraint visualization
Create constraints
Mover constraints typically connect one or two Class.Attachment|Attachments or Class.Bone|Bones. When connected to Class.Bone|Bones, the constraint will use their animated position and orientation.
To create a mechanical constraint, you can either insert one from the Constraint picker/button or through the Explorer window.
-
In Studio's Model tab toolbar, click‑hold over the small corner arrow on a constraint button to open its picker menu, then select the desired constraint.
-
In the 3D viewport, hover over any
Class.PartorClass.MeshPartand click to add a newClass.Attachmentto the part at the visualized point. Alternatively, hover over and click an existingClass.AttachmentorClass.Boneto use it for the constraint. -
Some mover constraints utilize or support a secondary attachment in their functionality, so the tool might prompt you to repeat the previous step on another
Class.Part,Class.MeshPart, orClass.Attachment, orClass.Bone.
[AngularVelocity](../physics/constraints/angular-velocity.md) using one attachment
[AlignPosition](../physics/constraints/align-position.md) using two attachments
-
In the Explorer hierarchy, hover over the intended parent, click the ⊕ button, and insert the desired constraint from the dropdown menu, such as a LinearVelocity constraint.
-
With the new constraint selected, locate its currently empty Attachment0 property in the Properties window.
-
Link the Attachment0 property to an
Class.AttachmentorClass.Bonein two consecutive steps:-
In the Properties window, click in the Attachment0 row to reveal the selection cursor.
-
In the Explorer hierarchy, click on the target
Class.AttachmentorClass.Bone.
-
-
Some mover constraints use or support a secondary
Class.AttachmentorClass.Bonein their functionality. If necessary, repeat the previous step on the Attachment1 property in the Properties window. For instance:- By default, AlignPosition and AlignOrientation align their primary attachment (Attachment0) with a secondary attachment (Attachment1).
- LineForce requires two attachments to apply force along the theoretical line connecting them.
Physical simulation
Legacy mover conversion
If your experience relies on legacy Class.BodyMover‑based constraints, review the following notes when converting to modern mover constraints.
-
In
Enum.ForceLimitMode|Magnitudemode, the existing behavior is preserved andClass.AlignPosition.MaxForce|MaxForceis interpreted as a magnitude. -
In
Enum.ForceLimitMode|PerAxismode, the force along each axis can be specified independently. Because the maximum force is specified as a vector, the reference frame of the force can also be specified through theClass.AlignPosition.ForceRelativeTo|ForceRelativeToproperty withEnum.ActuatorRelativeTo|World,Enum.ActuatorRelativeTo|Attachment0, andEnum.ActuatorRelativeTo|Attachment1options. Additionally, the formulation for the internal controller is modified to match that ofClass.BodyPosition.
Additionally, the Class.LinearVelocity.ForceLimitMode|ForceLimitMode property with the option of Enum.ForceLimitMode|PerAxis accommodates any applications of the vector force with all non‑zero components, such as an increase in the force along a single axis to counteract gravity.
As a separate improvement, Class.AngularVelocity works with Class.Attachment|Attachments and the Class.AngularVelocity.RelativeTo|RelativeTo property lets you specify the Datatype.CFrame in which the force is specified, for example Enum.ActuatorRelativeTo|World or Enum.ActuatorRelativeTo|Attachment1.