Reference API Roblox

Engine API

Website

Related

Reference API Roblox

AlignOrientation

Constraint which applies torque to align two attachments, or to align one attachment with a goal orientation.

Member index 12

HistoryMember
726AlignType: AlignType
726CFrame: CFrame
726LookAtPosition: Vector3
726MaxAngularVelocity: float
726MaxTorque: float
726Mode: OrientationAlignmentMode
726PrimaryAxis: Vector3
726PrimaryAxisOnly: bool
726ReactionTorqueEnabled: bool
726Responsiveness: float
726RigidityEnabled: bool
726SecondaryAxis: Vector3
inherited from Constraint
726Active: bool
726Attachment0: Attachment
726Attachment1: Attachment
726Color: BrickColor
726Enabled: bool
726Visible: bool
604GetDebugAppliedForce(bodyId: int): Vector3
604GetDebugAppliedTorque(bodyId: int): Vector3
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Removed member index 1

HistoryMember
495CoordindateFrame: CFrame

Description

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.

History 66

Members 12

AlignType

TypeDefault
AlignType

Specifies the desired relationship between the primary axes of Attachment0 and the goal. Available options are AllAxes, PrimaryAxisParallel, PrimaryAxisPerpendicular, and PrimaryAxisLookAt. The constraint will attempt to maintain the specified relationship, as given by the AlignType, by applying torques onto the relevant axes.

History 6

CFrame

TypeDefault
CFrame

The CFrame orientation (translation component ignored) with which the constraint will attempt to match the orientation of Attachment0. Only used when Mode is set to OneAttachment.

History 6

LookAtPosition

TypeDefault
Vector3

A Vector3 world space location toward which the primary axis will attempt to align. This is only active when AlignType is set to PrimaryAxisLookAt and Mode is set to OneAttachment.

This property is not replicated. Its interface does not cross the network boundary.

History 2

Tags: [NotReplicated]

MaxAngularVelocity

TypeDefault
float

Maximum angular velocity the constraint can use to reach its goal. Only used if RigidityEnabled is false.

Note that MaxAngularVelocity, as well as MaxTorque, are caps to the angular velocity and torque respectively. The actual scale is determined by Responsiveness.

History 5

MaxTorque

TypeDefault
float

Maximum torque the constraint can use to reach its goal. Only used if RigidityEnabled is false.

Note that MaxTorque, as well as MaxAngularVelocity, are caps to the torque and angular velocity respectively. The actual scale is determined by Responsiveness.

History 5

Mode

TypeDefault
OrientationAlignmentMode

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.

History 3

PrimaryAxis

TypeDefault
Vector3

The direction of the goal's X axis, represented as a unit Vector3. Only used when Mode is OneAttachment.

This property is not replicated. Its interface does not cross the network boundary.

History 6

Tags: [NotReplicated]

PrimaryAxisOnly

TypeDefault
bool

Determines how the constraint's axes are affected by torque. 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 become misaligned.

Enabling PrimaryAxisOnly also enables the AlignType property.

History 5

ReactionTorqueEnabled

TypeDefault
bool

If false (default), the constraint only applies torque to Attachment0 while Attachment1 remains unaffected. If true, the constraint applies torque to both attachments in equal and opposite directions.

History 5

Responsiveness

TypeDefault
float

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.

History 5

RigidityEnabled

TypeDefault
bool

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 by MaxTorque, MaxAngularVelocity, and Responsiveness. If true, the physics solver reacts as quickly as possible to complete the alignment.

History 5

SecondaryAxis

TypeDefault
Vector3

The direction of the goal's Y axis, represented as a unit Vector3. Only used when Mode is OneAttachment.

This property is not replicated. Its interface does not cross the network boundary.

History 6

Tags: [NotReplicated]

Removed members 1

CoordindateFrame

TypeDefault
CFrame

History 2

Settings