AlignPosition

Show Deprecated

An AlignPosition attempts to constrain its Attachment0's position to the goal position, which is determined by Attachment1 or Position depending on the Mode.

AlignPosition Demo

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.

Reaction force

AlignPositions by default only apply a force on Attachment0's parent Part. The parent Part of Attachment1 remains unaffected. However, a force can also be applied to Attachment1 by enabling the AlignPosition.ReactionForceEnabled. This will cause a force to be applied to both Attachment0 and Attachment1 in the direction of each other.

Force location

By default the force created by an AlignPosition is applied to the parent Part of Attachment0 at the Attachment's location. The direction of the force is always towards the goal. This means that if the center of mass of the Part is not aligned with the direction of the force, a torque will be applied to the part as well as a force.

AlignPositions' behaviors can be changed with the AlignPosition.ApplyAtCenterOfMass property. When enabled, the AlignPosition will check if other Parts are rigidly connected to the parent Part of Attachment0. If there are, then the force will be applied at the center of mass of those connected parts. If not, then the force will be applied at the center of mass of the parent part itself.

Force magnitude

The force used to constrain an AlignPosition can either be configured or set to the maximum that constraints allow. Whether the force is configurable is determined by the AlignPosition.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 connect other constraints, such as hinges when their attachments are separated.

When RigidityEnabled is false, then the force will be determined by the AlignPosition.MaxForce, AlignPosition.MaxVelocity, and AlignPosition.Responsiveness. MaxForce and MaxVelocity are caps to the force and velocities respectively. The actual scale of the force 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.

Summary

Properties

When true, applies force at center of mass of Attachment0's parent Part. When false, applied at Attachment0.

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

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

The way the constraint determines its goal.

The position the constraint should move its Attachment0 to when using the OneAttachment mode.

If true the constraint applies force on both Attachments to achieve the goal.

Controls how quickly the constraint reaches its goal. Higher values will cause the attachment(s) to align more rapidly. Value can be between 5 and 200.

If true, the solver reacts as quickly as possible to complete the alignment. If false, the torque is dependent on MaxForce, MaxVelocity, and Responsiveness.

Events

Methods

Properties

ApplyAtCenterOfMass

When true, applies force at center of mass of Attachment0's parent Part. When false, applied at Attachment0.

MaxForce

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

MaxVelocity

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

The Mode specifies the way its constraint determines its goal.

OneAttachment

The constraint attempts to move Attachment0 to Position. Attachment1 is not used.

TwoAttachment

The constraint attempts to move Attachment0 to the position of Attachment1. Position is not used.

Position

When the constraint's Mode is set to OneAttachment, it uses the Position as a goal to move the Attachment0 to.

ReactionForceEnabled

If true the constraint applies force on both Attachments to achieve the goal.

Responsiveness

Controls how quickly the constraint reaches its goal. Higher values will cause the attachment(s) to align more rapidly. Value can be between 5 and 200.

RigidityEnabled

If true, the solver reacts as quickly as possible to complete the alignment. If false, the torque is dependent on MaxForce, MaxVelocity, and Responsiveness.

Events

Methods