AlignPosition not working correctly when attached to character

When attaching a part to the character using AlignPosition with a set Velocity (5) and MaxForce (999999) it instantly goes to the character attachment instead of incrementally moving

Reproduction Steps:

Insert the following code into a LocalScript inside of StarterCharacterScripts

local character = script.Parent

local rootPartAttachment = Instance.new("Attachment")
rootPartAttachment.Position = Vector3.new(0, 0, 5)
rootPartAttachment.Parent = character.PrimaryPart

local part = Instance.new("Part")
part.CanCollide = false
part.Size = Vector3.one
part.Parent = character

local partAttachment = Instance.new("Attachment")
partAttachment.Parent = part

local alignPosition = Instance.new("AlignPosition")
alignPosition.Attachment0 = partAttachment
alignPosition.Attachment1 = rootPartAttachment
alignPosition.MaxForce = 999999
alignPosition.MaxVelocity = 5
alignPosition.Parent = part

This seems to be a bug. We are looking into this issue, will keep you posted.

This behavior is actually intended behavior of the AchivePosition Constraint; see here where @DrCherenkov left a detailed explanation: Character movement interferes with AlignPosition convergence - #3 by DrCherenkov

I would suggest a workaround for your intended usecase; have a Attachment you would like to use for the target position childed to an anchored part, and edit the CFrame of the attachment to match your desired position (ie, humanoid position). Hopefully you will be able to obtain desired behavior with this.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.