rojo/.cursor/rules/roblox/en-us/physics/mover-constraints.md
2026-02-02 14:05:11 -06:00

14 KiB
Raw Blame History

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.

[LinearVelocity](../physics/constraints/linear-velocity.md) applies force on an assembly to maintain a constant velocity along a 3D vector, line, or 2D plane

[AngularVelocity](../physics/constraints/angular-velocity.md) applies torque on an assembly to maintain a constant angular velocity

[AlignPosition](../physics/constraints/align-position.md) applies force to move two attachments together, or to move one attachment to a goal position

[AlignOrientation](../physics/constraints/align-orientation.md) applies torque to align two attachments, or to align one attachment with a goal orientation

[VectorForce](../physics/constraints/vector-force.md) applies constant linear force on an assembly

[Torque](../physics/constraints/torque.md) applies constant torque on an assembly from its center of mass

[LineForce](../physics/constraints/line-force.md) applies force along the theoretical line connecting its two attachments

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.

  1. 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.

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

  3. 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, or Class.Attachment, or Class.Bone.

    AngularVelocity using one attachment
    [AngularVelocity](../physics/constraints/angular-velocity.md) using one attachment
    AlignPosition using two attachments
    [AlignPosition](../physics/constraints/align-position.md) using two attachments
  1. 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.

    New LinearVelocity in Explorer window.
  2. With the new constraint selected, locate its currently empty Attachment0 property in the Properties window.

    Constraint's Attachment0 property highlighted in Properties window.
  3. Link the Attachment0 property to an Class.Attachment or Class.Bone in two consecutive steps:

    1. In the Properties window, click in the Attachment0 row to reveal the selection cursor.

    2. In the Explorer hierarchy, click on the target Class.Attachment or Class.Bone.

    Mouse pointer hovering over Attachment0 property in Properties window. Target attachment indicated in Explorer window.
  4. Some mover constraints use or support a secondary Class.Attachment or Class.Bone in 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.

`BodyPosition`  ⟩  `AlignPosition` `Class.AlignPosition` satisfies the majority of use cases covered by the deprecated `Class.BodyPosition` mover. To sync with how the legacy mover treated each component independently and allowed a different force along each dimension, the `Class.AlignPosition.ForceLimitMode|ForceLimitMode` property of `Class.AlignPosition` allows the constraint to operate in `Enum.ForceLimitMode|Magnitude` mode or `Enum.ForceLimitMode|PerAxis` mode:
  • In Enum.ForceLimitMode|Magnitude mode, the existing behavior is preserved and Class.AlignPosition.MaxForce|MaxForce is interpreted as a magnitude.

  • In Enum.ForceLimitMode|PerAxis mode, 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 the Class.AlignPosition.ForceRelativeTo|ForceRelativeTo property with Enum.ActuatorRelativeTo|World, Enum.ActuatorRelativeTo|Attachment0, and Enum.ActuatorRelativeTo|Attachment1 options. Additionally, the formulation for the internal controller is modified to match that of Class.BodyPosition.

`BodyGyro`  ⟩  `AlignOrientation` `Class.AlignOrientation` satisfies the majority of use cases covered by the deprecated `Class.BodyGyro` mover. The `Class.AlignOrientation.AlignType|AlignType` modes of `Class.AlignOrientation` provide sufficient freedom for most applications and the combination of multiple constraints can replicate the vector torque limit. Additionally, the `Enum.AlignType|PrimaryAxisLookAt` mode forces the primary axis of the constraint's first attachment (`Class.AlignOrientation.Attachment0|Attachment0`) to always point towards the second attachment (`Class.AlignOrientation.Attachment1|Attachment1`), making it a lot easier to add things such as motion tracking security cameras or guided missiles. `BodyVelocity`  ⟩  `LinearVelocity` `Class.LinearVelocity` satisfies the majority of use cases covered by the deprecated `Class.BodyVelocity` mover. Although the legacy mover allows for a `Class.BodyVelocity.MaxForce|MaxForce` vector, the typical application of that vector force was to zero a particular component, allowing the constraint to be disabled along that dimension. `Class.LinearVelocity` achieves a similar effect by operating in distinct `Class.LinearVelocity.VelocityConstraintMode|VelocityConstraintMode` modes that corresponded to one (`Enum.VelocityConstraintMode|Line`), two (`Enum.VelocityConstraintMode|Plane`), and three (`Enum.VelocityConstraintMode|Vector`) dimensions.

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.

`BodyAngularVelocity`  ⟩  `AngularVelocity` Although `Class.AngularVelocity` has some discrepancies with the deprecated `Class.BodyAngularVelocity` mover, specific cases related to those discrepancies have not been highlighted by the community, nor internally.

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.

`BodyForce`/`BodyThrust`  ⟩  `VectorForce` `Class.VectorForce` satisfies all use cases offered by the deprecated `Class.BodyForce` and `Class.BodyThrust` movers. The modern constraint works with `Class.Attachment|Attachments` and its `Class.VectorForce.RelativeTo|RelativeTo` property lets you apply force to a relative offset from center, similar to how `Class.BodyThrust.Location` worked. `RocketPropulsion`  ⟩  `LineForce`/`AlignOrientation` A combination of `Class.LineForce` and `Class.AlignOrientation` satisfies the majority of use cases covered by the deprecated `Class.RocketPropulsion` mover. In the example of a guided missile, `Class.LineForce` can be used to control the "follow target" behavior of `Class.RocketPropulsion` while `Class.AlignOrientation` and its `Class.AlignOrientation.LookAtPosition|LookAtPosition` property can be used to control the "face target" behavior.