Class · inherits Constraint
AlignOrientation
Constraint which applies torque to align two attachments, or to align one attachment with a goal orientation.
About 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 AlignPosition).
Torque created by AlignOrientation is applied about the center of mass of
the parent of the attachments, or the center of mass of parts rigidly
connected to the parents.
When configuring this constraint, it may be helpful to study Roblox Units to understand how Roblox units compare to metric units.
Affected Axes
The axes affected by torque are controlled through the constraint's
AlignType property. When set to
PrimaryAxisParallel,
PrimaryAxisPerpendicular or
PrimaryAxisLookAt, torque will only occur when the primary
axes become misaligned. Otherwise, the constraint will apply torque about all
3 axes to achieve alignment.
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.
Torque Magnitude
You can configure this 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
This constraint can use either one or two attachments in calculating
its goal. See Mode for details.
Properties 11
AlignType
: AlignTypeThe constraint's axis alignment type.Specifies the desired relationship between the primary axes of
Attachment0and the goal. Available options areAllAxes,PrimaryAxisParallel,PrimaryAxisPerpendicular, andPrimaryAxisLookAt. The constraint will attempt to maintain the specified relationship, as given by theAlignType, by applying torques onto the relevant axes.CFrame
: CFrameTheCFrameorientation with which the constraint will attempt to match the orientation ofAttachment0.The
CFrameorientation (translation component ignored) with which the constraint will attempt to match the orientation ofAttachment0. Only used whenModeis set toOneAttachment.LookAtPosition
: Vector3NotReplicatedAVector3world space location toward which the primary axis will attempt to align.A
Vector3world space location toward which the primary axis will attempt to align. This is only active whenAlignTypeis set toPrimaryAxisLookAtandModeis set toOneAttachment.MaxAngularVelocity
: floatMaximum angular velocity the constraint can use to reach its goal.Maximum angular velocity the constraint can use to reach its goal. Only used if
RigidityEnabledisfalse.Note that
MaxAngularVelocity, as well asMaxTorque, are caps to the angular velocity and torque respectively. The actual scale is determined byResponsiveness.MaxTorque
: floatMaximum torque the constraint can use to reach its goal.Maximum torque the constraint can use to reach its goal. Only used if
RigidityEnabledisfalse.Note that
MaxTorque, as well asMaxAngularVelocity, are caps to the torque and angular velocity respectively. The actual scale is determined byResponsiveness.Mode
: OrientationAlignmentModeWhether the constraint uses one or two attachments in calculating its goal.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 ofAttachment0with the orientation ofAttachment1, disregardingCFrame,PrimaryAxis, andSecondaryAxis.If set to
OneAttachment, the constraint disregardsAttachment1and attempts to match the orientation ofAttachment0with the orientation ofCFrame, or match the attachment'sAxisandSecondaryAxiswith the constraint'sPrimaryAxisandSecondaryAxisproperties respectively.PrimaryAxis
: Vector3NotReplicatedThe direction of the goal's X axis, represented as a unitVector3.The direction of the goal's X axis, represented as a unit
Vector3. Only used whenModeisOneAttachment.ReactionTorqueEnabled
: booleanWhether the constraint applies torque only toAttachment0, or to both attachments in equal and opposite directions.If
false(default), the constraint only applies torque toAttachment0whileAttachment1remains unaffected. Iftrue, the constraint applies torque to both attachments in equal and opposite directions.Responsiveness
: floatControls how quickly the constraint reaches its goal. Higher values cause the attachment(s) to align more rapidly.Controls how quickly the constraint reaches its goal. Higher values cause the attachment(s) to align more rapidly. Value can be between 5 and 200.
RigidityEnabled
: booleanWhether torque is dependent on other properties, or if the physics solver reacts as quickly as possible to complete the alignment.Whether torque is dependent on other properties, or if the physics solver reacts as quickly as possible to complete the alignment. If
false(default), the torque is determined byMaxTorque,MaxAngularVelocity, andResponsiveness. Iftrue, the physics solver reacts as quickly as possible to complete the alignment.SecondaryAxis
: Vector3NotReplicatedThe direction of the goal's Y axis, represented as a unitVector3.The direction of the goal's Y axis, represented as a unit
Vector3. Only used whenModeisOneAttachment.
AlignOrientation also has every member of Constraint. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.