Reference API Roblox

Engine API

Website

Related

Reference API Roblox

AlignPosition

Constraint which applies force to move two attachments together, or to move one attachment to a goal position.

Member index 11

HistoryMember
726ApplyAtCenterOfMass: bool
726ForceLimitMode: ForceLimitMode
726ForceRelativeTo: ActuatorRelativeTo
726MaxAxesForce: Vector3
726MaxForce: float
726MaxVelocity: float
726Mode: PositionAlignmentMode
726Position: Vector3
726ReactionForceEnabled: bool
726Responsiveness: float
726RigidityEnabled: bool
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)

Description

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 AlignOrientation).

When configuring this constraint, it may be helpful to study Roblox Units to understand how Roblox units compare to metric units.

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.

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.

Force Limits

You can configure this 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 applied by the constraint is limited based on ForceLimitMode, MaxVelocity, and Responsiveness. See ForceLimitMode for further details.

Attachment Mode

This constraint can use either one or two attachments in calculating its goal. See Mode for details.

History 48

Members 11

ApplyAtCenterOfMass

TypeDefault
bool

When false (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. When true, force is applied at the parents' center of mass.

History 5

ForceLimitMode

TypeDefault
ForceLimitMode

Determines how the constraint force will be limited when RigidityEnabled is false. When set to Magnitude, the constraint force will be limited such that the magnitude is less than MaxForce. When set to PerAxis, the constraint force along each axis will be limited by MaxAxesForce. The axes along which the force will be limited are based on the ForceRelativeTo property.

History 3

ForceRelativeTo

TypeDefault
ActuatorRelativeTo

Determines the axes that the constraint uses to limit the force. Only applies when RigidityEnabled is false and AlignPosition.ForceLimitMode is PerAxis. When set to World, the constraint force is computed in the world reference frame and the force limits specified in MaxAxesForce refer to the axes of the world coordinate system. When set to Attachment0 or Attachment1, the force limits specified in MaxAxesForce refer to the axes of the specified attachment coordinate system.

History 2

MaxAxesForce

TypeDefault
Vector3

Maximum force along each axis that the constraint can apply to achieve its goal. Only used if RigidityEnabled is false and ForceLimitMode is PerAxis. The axes used to apply to the limit are specified using the ForceRelativeTo property.

History 2

MaxForce

TypeDefault
float

Maximum force magnitude the constraint can apply to achieve its goal. Only used if RigidityEnabled is false and ForceLimitMode is Magnitude.

Note that MaxForce, as well as MaxVelocity, are caps to the force and velocity respectively. The actual scale is determined by Responsiveness.

History 5

MaxVelocity

TypeDefault
float

Maximum speed the attachments can move when converging. Only used if RigidityEnabled is false.

Note that MaxVelocity, as well as MaxForce, are caps to the velocity and force respectively. The actual scale is determined by Responsiveness.

History 5

Mode

TypeDefault
PositionAlignmentMode

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.

History 3

Position

TypeDefault
Vector3

The position to which the constraint should move its Attachment0. Only used if Mode is set to OneAttachment, in which case Attachment1 is disregarded.

History 3

ReactionForceEnabled

TypeDefault
bool

If false (default), the constraint only applies force to Attachment0 while Attachment1 remains unaffected. If true, the constraint applies force 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 force is dependent on other properties, or if the physics solver reacts as quickly as possible to complete the alignment. If false (default), the force is determined by MaxForce, MaxVelocity, and Responsiveness. If true, the physics solver reacts as quickly as possible to complete the alignment.

History 5

Settings