Mover Constraints

The physics engine includes several Constraints that apply force or torque to move one or more assemblies. This article outlines every mover constraint and how to create them in Studio.

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

Mover constraints typically connect one or two Attachments. They can also connect one or two Bones (a sub-class of Attachment) in which case the constraint will use the animated position of those bones.

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

To create a constraint on existing Parts, MeshParts, or Attachments using the Create tool:

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

    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 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 Part, MeshPart, or Attachment.

    AngularVelocity using one attachment
    AngularVelocity using one attachment
    AlignPosition using two attachments
    AlignPosition using two attachments

Mover Constraints Overview

LinearVelocity

The LinearVelocity constraint applies force on an assembly to maintain a constant velocity. It can be set to apply force along a Vector3, line, or 2D plane.

Relativity

Application of velocity can be controlled through the constraint's RelativeTo property. If set to World, force will be applied in world coordinates, independent of the parent or attachment orientations. If set to Attachment0 or Attachment1, force will be applied relative to Attachment0 or Attachment1 respectively.

RelativeTo = World
RelativeTo = Attachment0

AngularVelocity

The AngularVelocity constraint applies torque on an assembly to maintain an angular velocity.

Relativity

Application of velocity can be controlled through the constraint's RelativeTo property. If set to World, the angular velocity vector is used as is. If set to Attachment1 and the constraint's Attachment1 property is set to another attachment, the angular velocity will be affected by that of the other attachment as seen by how the upper-left red part's velocity affects the attached blue part's velocity.

RelativeTo = World
RelativeTo = Attachment1

AlignPosition

The AlignPosition constraint applies force to move two attachments together, or to move one attachment to a goal position. As indicated by the name, it only affects the position of the attachments, not their orientation (to align attachments by orientation, see Align Orientation).

Force Location

By default, force is applied to the parent of Attachment0 at that attachment's location, meaning that if the parent's center of mass is not aligned with the direction of the force, torque will be applied as well as force. Alternatively, force can be applied to the parents' center of mass by toggling on ApplyAtCenterOfMass.

AlignPosition.ApplyAtCenterOfMass = false

Reactionary Force

By default, the constraint only applies force to Attachment0 while Attachment1 remains unaffected. If desired, force can be applied to both attachments in equal and opposite directions by enabling ReactionForceEnabled.

AlignPosition.ReactionForceEnabled = false

Force Magnitude

You can configure the AlignPosition constraint to apply the maximum force that constraints allow through the RigidityEnabled property. When true, the physics solver reacts as quickly as possible to complete the alignment. When false, the force is determined by MaxForce, MaxVelocity, and Responsiveness.

Attachment Mode

The Mode property specifies whether the constraint uses one or two attachments in calculating its goal. By default, this is TwoAttachment, meaning that the constraint disregards Position and attempts to move Attachment0 to the position of Attachment1. If set to OneAttachment, the constraint disregards Attachment1 and attempts to move Attachment0 to Position.

AlignOrientation

The AlignOrientation constraint applies torque to align two attachments, or to align one attachment with a goal orientation. As indicated by the name, it only affects the orientation of the attachments, not their position (to align attachments positionally, see Align Position).

Affected Axes

The axes affected by torque are controlled through the constraint's PrimaryAxisOnly property. If false (default), the constraint will apply torque about all 3 axes to achieve alignment. If true, torque will only occur when the primary axes (visually represented by the upward-pointing arrows) become misaligned.

AlignOrientation.PrimaryAxisOnly = false

Reactionary Torque

By default, the constraint only applies torque to Attachment0 while Attachment1 remains unaffected. If desired, torque can be applied to both attachments in equal and opposite directions by enabling ReactionTorqueEnabled.

AlignOrientation.ReactionTorqueEnabled = false

Torque Magnitude

You can configure the AlignOrientation constraint to apply the maximum torque that constraints allow through the RigidityEnabled property. When true, the physics solver reacts as quickly as possible to complete the alignment. When false, the torque is determined by MaxTorque, MaxAngularVelocity, and Responsiveness.

Attachment Mode

The Mode property specifies whether the constraint uses one or two attachments in calculating its goal. By default, this is TwoAttachment, meaning that the constraint attempts to match the orientation of Attachment0 with the orientation of Attachment1, disregarding CFrame, PrimaryAxis, and SecondaryAxis.

If set to OneAttachment, the constraint disregards Attachment1 and attempts to match the orientation of Attachment0 with the orientation of CFrame, or match the attachment's Axis and SecondaryAxis with the constraint's PrimaryAxis and SecondaryAxis properties respectively.

VectorForce

The VectorForce constraint applies constant force to an assembly. The direction and strength of the force is determined by a Vector3 and can be relative to an attachment on the part, another attachment, or the world coordinate system.

Force Location

By default, force is applied to the assembly at the location of Attachment0. Thus, if its center of mass is not aligned with the direction/point of force, torque will be applied as well. If desired, force can be focused at the center of mass by toggling on ApplyAtCenterOfMass.

ApplyAtCenterOfMass = false
ApplyAtCenterOfMass = true

Relativity

By default, force is applied relative to Attachment0. If the parent assembly rotates, the force will change direction to match the adjusted orientation of the attachment; visualize this behavior in how the thruster of a rocket pushes it forward, regardless of the rocket's rotation.

If RelativeTo is set to World, force will be applied in world coordinates, independent of the parent or attachment orientations; visualize this behavior as a directional force like the wind blowing against an object.

If RelativeTo is set to Attachment1, force will be applied relative to Attachment1 and, if the attachment rotates, change to match its orientation.

RelativeTo = Attachment0
RelativeTo = World

Torque

A Torque constraint applies constant torque to an assembly from its center of mass.

Relativity

By default, torque is applied relative to Attachment0. If the parent assembly rotates, the torque will change direction to match the adjusted orientation of the attachment.

If RelativeTo is set to World, torque will be applied in world coordinates, independent of the parent or attachment orientations.

If RelativeTo is set to Attachment1, torque will be applied relative to Attachment1 and, if the attachment rotates, change to match its orientation.

RelativeTo = Attachment0
RelativeTo = World

LineForce

The LineForce constraint applies a force along the theoretical line connecting its two Attachments. As the end points (attachments) move, the direction of force will change accordingly.

Force Location

By default, force is applied to either parent at its attachment location. If desired, force can be focused at each parent's center of mass by toggling on ApplyAtCenterOfMass.

ApplyAtCenterOfMass = false
ApplyAtCenterOfMass = true

Inverse Square Law

When InverseSquareLaw is true, the force magnitude is multiplied by the inverse square of the distance, meaning the force will increase exponentially as the two attachments get closer together, like magnets. When using this setting, it's recommended that you set a MaxForce threshold to prevent infinite force if the attachments align precisely.

InverseSquareLaw = false
InverseSquareLaw = true

Reactionary Force

By default, the constraint only applies force to Attachment0, while Attachment1 remains unaffected. However, force can be applied to both attachments in equal and opposite directions by enabling ReactionForceEnabled.

ReactionForceEnabled = false
ReactionForceEnabled = true