AlignPosition per axis giving strange results

Recently AlignPosition was given a ‘per axis’ property, allowing users to control what axis AlignPosition controlled. I required this feature to only control the Y axis. However despite this, I am not getting the results I expect.

I am using AlignPosition to set the height of the gliders on my trains system. Because I am only controlling the Y axis, I expect, regardless of what the X and Z position is set to, for it to only control the gliders Y positioning. The AlignPosition ForceLimitMode is set to PerAxis, and the MaxAxesForce only has force on the Y axis, with X and Z being set to zero.

The two gliders are welded, through constraints, to this base part. If I have the AlignPosition set to the Glider’s X and Z position, and then update the Y position, I get the results I expect:

However, if the AlignPosition’s X and Z position values are not set to the Glider’s X and Z position values, regardless of the fact that the PerAxis property is stating to only control the Y position, I get some very strange behaviour:

I wouldn’t expect these results, I would instead expect the same behaviour regardless of what the X and Z position is set to because the PerAxis property is telling the AlignPosition to only update the Y position.

I have attached a ReproFile below. First, try and just change the Y position of one Glider, and it works as intended. Then set the X and Z of the AlignPosition to something different and it suddenly gives these strange result. Given the fact I only want to control the Y position, I don’t want to have to constantly update the AlignPosition’s X and Z to whatever the Gliders X & Z position is as they need to move freely along the tracks.

AlignPositionTest.rbxl (56.6 KB)

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!

Looking at your ReproFile, I noticed that the property ForceRelativeTo is listed as Attachment0. Was this intentional? When set to this mode, the MaxAxesForce is specified relative to the axes of the attachment, not the world space. As the glider moves upward along the World-Y axis, it rotates the attachment, causing the force to no longer be parallel with the global Y-axis and making the other components of the target position important.

Changing this property to ‘World’ seems to give the behavior you want, the X & Z positions of the target are ignored and only the Y position of the glider is adjusted to match the Y component of the target.

Ah, that’s what causes it. Yes all works as intended now. Thanks!

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