How to accurately set speeds of BodyPosition

I want to have a platform move from 1 position to another, at a constant rate of speed. Problem I am having with BodyPosition, is a lot of the time it starts fast and then slows down before it gets to the end.

These are my current values
image

Please don’t just tell me to trial and error. I’ve tried high/low numbers in either positions, varying amounts, etc. Nothing I do results in a smooth movement.

while true do
	if not movePart or not movePart.Parent then break end
	
	local Start = movePart:GetAttribute("Start")
	local Finish = movePart:GetAttribute("Finish")
				
	BodyPosition.Position = Finish
			
	while (movePart.Position - Finish).Magnitude > 2 do wait() end
				
	wait(2)
	
	BodyPosition.Position = Start
				
	while (movePart.Position - Start).Magnitude > 2 do wait() end
	
	wait(2)
end

ezgif.com-gif-maker (85)

The parts also rotate for some reason? I have a BodyGyro inside of them, but they still get a weird offset rotation

1 Like

Try using tweening to move them, much safer (in terms of movement) and much more smooth and customizable.
Edit: if you just want them to use body position, lower D (dampening) it slows it as it reaches it target, which makes it unprecise (same with body gyro)

Can’t use tweens as they dont make the player move when you are on top of them

1 Like

oh I didn’t know that lol (i always thought tween would do that) just try what I suggested ig

You could use TweenService to move the BodyPosition’s Position rather than the part’s CFrame.

Or you can use a BodyMover or constraint move suited to this, like BodyVelocity or a PrismaticConstraint with an ActuatorType of Motor. That last option is probably the best for you?

Nah He just has to lower the D value in the Body Position

1 Like

Sure, that will make it closer. It won’t be perfectly linear though, and might overshoot the target.

Yeah thats the problem about body forces. The problem about tween is that it does not care about collisions and thus will not move your character.

I would suggest you use RocketPropulsion | Roblox Creator Documentation instead of BodyPosition just because you can set a MaxSpeed. If you want to use BodyPosition try to use very big values both for dampening and P (Try 1000, 2000, 10000 and see how they look).

I would not suggest you tween the BodyPosition’s position because that in itself will send a lot of data back and forth (possibly causing lag) if you animate on the server (which I assume you do).

For the rotation, make sure the BodyGyro has MaxTorque on all axis and is a high number (again try 1000, 2000, 10000) and same for the P (make it a big number).

I hope this helps and good luck!