I’ve been using constraints for a while now, and I just can’t seem to find a clean way to “sync” the player character’s position to one axis smoothly without using the legacy BodyPosition instance.
Example:
If I have the player on a hoverboard, and I want their vertical (Y) position to smoothly change based on what’s underneath them, it’s currently impossible to do that using the AlignPosition constraint without also having to set the other axes, and setting them to 0 will position the player at the origin, not negate them. This is a problem because AlignPosition is not quite designed to be used for directional movement, and so all sorts of problems begin to arise when attempting to do so.
For instance, I could use an AlignPosition object to update all axes of the player movement, but if I want responsive directional/horizontal movement, then I will need to be willing to sacrifice smooth movement on the Y axis, because I need the AlignPosition object to be responsive on the other horizontal axes.
I’ve also tried using LinearVelocity in Line constraint mode to update the Y position, but since it takes a direction and a velocity, it’s not possible to update the vertical position smoothly using this approach either. Also, rapid changes in vertical positioning result in rough “bouncing” using this constraint.
Lastly, we have VectorForce, which can be used to act on only 1 axis as well. Problem is, this constraint applies a force to the specified axes, and so its effects are not deterministic but physics-based.
I’m aware of other approaches, such as using a Plane constraint to lock a part to an axis, but that’s not what I want. Instead, I simply want to accomplish a smooth change in vertical positioning based on what’s underneath the player, with no regards to their horizontal movement.