Title explains everything, what’s the difference? (Besides that one needs a primary part and the other doesn’t.)
PivotTo
is a function inherited both by BaseParts and Models from PVInstance
class, meanwhile SetPrimaryPartCFrame
is function of Model
class and can not be called on instances which inherit BasePart
class.
As far as I know, :PivotTo()
works with PVIntsances
therefore you can use it on Parts, Models without PrimaryParts, etc. I use :PivotTo()
instead of :SetPrimaryPartCFrame()
because the latter has some sort of precision loss over time (you can test it out yourself).
I know SetPrimaryPartCFrame has precision loss over time.
Commonly devs used PrimaryPart to be able to use SetPrimaryPartCFrame and that way move models around easier. But now that they have PivotTo and WorldPivot. I think these two work hand in hand like SetPrimaryPartCFrame and PrimaryPart, respectively.
https://developer.roblox.com/en-us/api-reference/function/Model/SetPrimaryPartCFrame
https://developer.roblox.com/en-us/api-reference/function/PVInstance/PivotTo
Additionally:
SetPrimaryPartCFrame has been superseded by PVInstance:PivotTo
which acts as a more performant replacement and does not change your code’s behavior. Use PVInstance:PivotTo
for new work and migrate your existing Model:SetPrimaryPartCFrame
calls when convenient.
What’s the point though? Just use .CFrame am I wrong?