What do you guys use in place of BodyPosition?

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.

LinearVelocity would be suitable for the task if you apply damping to it.

1 Like

It depends on what you are doing.

For example, if you are making a turret for players to use, using the new HingeConstraint for movement on that is so much better than using BodyGyro that people would use for it previously.

However, if you are looking for BodyMover replacements to make a plane, nothing beats BodyVelocity and BodyGyro. The replacement for BodyGyro, AlignOrientation/AlignPosition, is honestly so bad. I was working on converting a plane system of mine to the new constraints, and here’s what happened when I switched from BodyGyro to AlignOrientation.. It’s not good.

Sure I could tweak it, but using that same code I used for AlignOrientation with minimum tweaks, this is how it looked with BodyGyro. Much better.

LinearVelocity is pretty much the same thing as BodyVelocity, so I would recommend switching to that, but I will continue to use BodyGyro otherwise.

BodyPosition’s replacement isn’t very good either, and I plan to continue using BodyPosition for systems like ships and boats