By default, this constraint only applies torque on Attachment0's parent, although it can be configured to apply torque on both attachments. This torque can be limited to a max amount via AlignOrientation.MaxTorque.
Any torque created by AlignOrientation will be applied about the center of mass of the parent of the attachments (or the center of mass of parts rigidly connected to the parents). Also note that if this constraint attaches one part (A) to another part (B) that is anchored or connected to an anchored part (Z), part A will not be locally simulated when interacting with a player.
The behavior of an AlignOrientation is determined by its AlignOrientation.PrimaryAxisOnly property. By default this value is false and an AlignOrientation will work so that the orientation of its Attachment0 exactly matches the orientation of its goal. It will apply torque about all 3 axes to achieve this goal.
If PrimaryAxisOnly is set to true, then the AlignOrientation will only apply torque if the primary axis of its Attachment0 becomes unaligned with the goal. This means that any rotation about the Attachment0's primary axis will not create a torque.
The torque used to constrain an AlignOrientation can either be configured or set to the maximum that constraints allow. Whether the torque is configurable is determined by the AlignOrientation.RigidityEnabled property.
When RigidityEnabled is true, the physics solver reacts as quickly as possible to complete the alignment. This is the same scale of force used to align other constraints, such as prismatics when their attachments are misaligned.
When RigidityEnabled is false, then the force will be determined by the MaxTorque, MaxAngularVelocity, and Responsiveness. MaxForce and MaxVelocity are caps to the torque and angular velocity respectively. The actual scale of the torque is determined by the Responsiveness. The mechanism for responsiveness is a little complicated, but put simply the higher the responsiveness, the quicker the constraint will try to reach its goal.
AlignOrientations by default only apply a torque on Attachment0's parent Part. The parent Part of Attachment1 remains unaffected. However, a torque can also be applied to Attachment1 by enabling the AlignOrientation.ReactionTorqueEnabled. This will cause a torque to be applied to both Attachment0 and Attachment1 in equal and opposite directions.
1local RunService = game:GetService("RunService")23local part1 = Instance.new("Part")4part1.Name = "Part1"5part1.Parent = game.Workspace6part1.Anchored = true7part1.Position = Vector3.new(-7, 2, 3)89local part2 = Instance.new("Part")10part2.Name = "Part2"11part2.Parent = game.Workspace12part2.Anchored = false13part2.Position = Vector3.new(-7, 2, 8)1415local attachment0 = Instance.new("Attachment")16attachment0.Parent = part21718local attachment1 = Instance.new("Attachment")19attachment1.Parent = part12021local alignOrientation = Instance.new("AlignOrientation")22alignOrientation.Parent = part123alignOrientation.Attachment0 = attachment024alignOrientation.Attachment1 = attachment125alignOrientation.RigidityEnabled = true2627RunService.RenderStepped:Connect(function()28 part1.CFrame = part1.CFrame * CFrame.Angles(0, 0.05, 0)29end)
When true the constraint will apply torque on both Attachments to achieve the goal.
Controls how quickly the constraint will reach its goal. Higher values will cause the attachment to align quicker. Value can be between 5 and 200.
The AlignType specifies the desired relationship between the primary axes of the Attachment0 and the goal. The constraint will try to maintain this relationship by applying forces within specified limits.
This property is visible in Studio and meaningful only when AlignOrientation.PrimaryAxisOnly is set true.
It can be set to any of the possible AlignType values.
|Parallel||0||Two parallel axes|
|Perpendicular||1||Two perpendicular axes|
The Mode specifies the way its constraint determines its goal orientation.