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.
- 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.
- Align Position: This was alot better than Body Position, but you cannot restrict it to certain axis.
- CFrame adjustements: This is not performant enough, but this code shows what it does.
game:GetService("RunService").HeartBeat:Connect(function()
part.CFrame = part.CFrame - part.CFrame.Position + Vector3.new(part.Position.X, 0, part.Position.Z)
end)
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.