CFrame Rotation issues

Hello!

I am currently rotating a models PrimaryPart slowly during each RenderStep. It comes out to a nice smooth rotation.

On a side note, I’ve noticed an issue regarding parts on the model. The parts near the edge of the model slowly ease away, at an outward velocity, from the middle of the model.

Here is a photo of one of the parts in the correct position.
https://gyazo.com/8601024985aff45a852ca3416c335751

Then a photo of the same part after running the rotation for a few minutes.
https://gyazo.com/b4b18c24d8daed2cb49eb7883d89ec21

note; the Direction value is either 1 or -1. [Counterclock wise or Clockwise].

rs:BindToRenderStep("Turntable", 1, function()
	if not script.Stop.Value then turnSpeed = turnSpeed + (0.00001 * script.Direction.Value) if math.abs(turnSpeed) >= math.abs(0.002 * script.Direction.Value) then turnSpeed = (0.002 * script.Direction.Value) end end
	if script.Stop.Value then turnSpeed = turnSpeed - (0.00001 * script.Direction.Value) if script.Direction.Value >= 1 then if turnSpeed < 0 then turnSpeed = 0 end else if turnSpeed > 0 then turnSpeed = 0 end end end
	model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(0, turnSpeed, 0))
end)

I’m kind of new to CFrame and I’m not entirely sure what’s causing the unwanted movement. Any solutions or ideas?

I really appreciate any help you can provide.

The parts move away from each other due to floating point inaccuracies that add up over time.
Currently the best way to CFrame a model is to weld all parts in it to an anchored central part using Motor6Ds (welds don’t work if the central part is anchored for some reason) and then just setting that parts CFrame to whatever you want.
This way you won’t have the issue of the parts in the model drifting away from each other and it is actually faster than using SetPrimaryPartCFrame.

1 Like

I’ll try this out, thanks!