Is it possible to efficiently do instant axial positioning on unanchored parts?

Me and my team wanted to have parts, on the server, that linearly move across the X and Z axis. After trying many methods, we discovered that the best way to do this was to use a Body Velocity. Anchoring the parts and adjusting the CFrames was not performant enough. By doing this, we were also able to get collisions handled, without any extra work. This came with the downside of having the Y axis (up and down) being physically simulated as well.

Why is this issue?
We do not want any movement along the Y axis, at all. Here are 3 things I have tried so far.

  1. Body Position: Does not lock the Y axis like we want, instead, it applies forces to move the part to the desired position. This behavior is not desired, and no matter the value of the properties, it is always noticeable.
  2. Align Position: This was alot better than Body Position, but you cannot restrict it to certain axis.
  3. CFrame adjustements: This is not performant enough, but this code shows what it does.
     part.CFrame = part.CFrame - part.CFrame.Position +, 0, part.Position.Z)

It Also makes physics just a little more jumpy. I did find that HeartBeat had the best results.

This has to happen on many parts.

Is there any way to just restrict physics movement for certain axis and parts. It would also be cool if I could disable rotation velocity without using a body gyro.

In sum, the issue is that the body movers and constraints HAVE to do everything smoothly. All I want is the ability to fully restrict movement on an axis, and rotation on all axis, instantly. (if the P property is too high btw, it just bugs out)
Thank you.

Those PrismaticConstraints look promising, though I haven’t used them before and couldn’t get it to work like you describe in the few min I messed with it. Looks like the part plus attachments and all can be rotated together to maybe give a linear movement constraint along any straight line (with rotation constrained too).

What kinds of performance problems were you seeing with CFrame and Heartbeat? If it’s taking too long to handle a large number of parts, that could also be related to the structures/methods you are using to store or get the parts for use or how you’re handling the loops. There is also a “step” parameter for heartbeat that isn’t being used in the snippet you posted, which can be used to adjust positions based on the actual amount of time that’s elapsed between calls to heartbeat.

Not sure what else to offer without knowing more specifics. What kind of collisions are you wanting? Should the objects just behave as if anchored, but moving, or should a player be able to interact with them (move them around in x,z)? AlignOrientation can also be used to stop rotation, but that’s 6 of one and half dozen of the other. If you work out using CFrames, you can move the obj and apply constraints to both pos and rotation at the same time.

Did you look at TweenService?

At this point. I would be satisfied with a way to just disable RotVelocity, without using a body gyro.