Does :PivotTo(CF) have any performance benefits over .CFrame = CF?

I think the title is pretty much self-explanatory. I haven’t seen anyone comparing the two methods but I have read in a reply to a specific topic that Instance:PivotTo(CF) is better than using Instance.CFrame = CF

I understand that if it is faster it’s probably only by a minuscule amount, but I just wanna know.

.CFrame is used to change the cframe of an instance, but if you try this on a model, it won’t work or it will return an error

:PivotTo() previously called :SetPrimaryPartCFrame() is a function used to set the primary part cframe, usually a model have a primary part, and you use this function to set the cframe of a model

One thing you should understand is:
model.PrimaryPart.CFrame = cframe will set the primary part cframe only, the entire model won’t move

model:PivotTo(cframe) will move the entire model cframe to the cframe

Now if you say part:PivotTo it returns an error, as the part does not have a primary part, the instance itself is a part

There are no performance benefits, but the you cannot use .CFrame on a model to move it entirely


You can definitely use :PivotTo() to change an Instance’s CFrame. I tried it with a regular part before, and it produced same results. I had just wondered if there were any performance benefits, whether if you used it in cases where it sets the CFrame only once, or multiple times for a moving part.

PivotTo works with most BaseParts, it works for things called PVInstances which are basically objects that have a physical location in the world.

From testing I’ve noticed PivotTo is not completely synchronous, is delayed (by a frame?) and is buggy. I recommend using SetPrimaryPartCFrame instead.

1 Like

SetPrimaryPartCFrame has been superseded by PivotTo. If it comes down to performance you should always use PivotTo over SetPrimaryPartCFrame. If there is any delay comparison between PivotTo and SetPrimaryPartCFrame, please replicate the issue and forward it to the Roblox team, then I’m sure they will take a look at it. :slight_smile:

Using BasePart:PivotTo() is possible since it is also an a pivot instance. Where did you get the idea that pivotto is exclusive to models?

1 Like

I ran some rudimentary tests and it seemed PivotTo isn’t really delayed compared to SetPrimaryPartCFrame.

PivotTo:                0.061286117997951806 -- 1000 iterations
SetPrimaryPartCFrame:   0.10277076398779172 -- 1000 iterations

Though it’s very possible that my benchmark is just improper, it’s very simple and there are probably better methods for more accuracy.

-- Properties
local StartTime = os.clock()
local Amount = 1000

for _ = 1, Amount do
	workspace.Dummy:PivotTo( workspace.Dummy:GetPivot() *, 0, 0) )

print('PivotTo: '.. os.clock() - StartTime)

-- Properties
local StartTime = os.clock()

for _ = 1, Amount do
	workspace.Dummy:SetPrimaryPartCFrame( workspace.Dummy:GetPrimaryPartCFrame() *, 0, 0) )

print('SetPrimaryPartCFrame: '.. os.clock() - StartTime)

(I think I should’ve used an amount lesser than 1000, if someone can actually benchmark the difference between using :PivotTo() instead of :SetPrimaryPartCFrame for models and Instance.CFrame = CF using a more precise system that would be pretty cool.)

1 Like

:PivotTo() is most often used for models only, however it might be working for normal parts too, but CFrame and Position and Orientation are used for parts

Every part and model has a pivotPoint, imagine it being the equivalent of a GUI object’s anchorpoint.

It’s very useful if you wish to rotate for example a door, because you can set the pivotpoint of the door-part to the side, without the need of a hinge.

I would not trust this benchmark since it does not leave room for error such as caching.

You shouldn’t have any performance differences since you are modifying geometry either way.