Why is it CFrame * CFrame instead of CFrame + CFrame?

Sometimes in code, I see stuff like

model:SetPrimaryPartCFrame(game.Workspace.Part.CFrame * offsetCFrame)

My question is, shouldn’t it be + before the offsetCFrame instead of *? Since you basically take the part’s CFrame and add an offset to it. Is there something special about CFrames regarding this? Please explain

1 Like

Well I dont know how to help here but I think these posts can help you:

The reason for this is that it simply doesn’t make sense to add two CFrames together (it will give you an error).

CFrames contain both positional and rotational information. Even though it makes sense to add a position to a position, it doesn’t make sense to add a 3D rotation to another 3D rotation. Hence, you cannot add two CFrames.

You could add a Vector3 to a CFrame, because a Vector3 contains only positional information:

print(myCFrame + myVector3)

This basically takes the CFrame (position and rotation) and translates it by the given Vector3 (position only).

Also keep in mind that CFrames are stored as matrices, and when we use the * operator on matrices, we are actually performing matrix multiplication, which is necessary to “add” two 3D rotations.

Alternatively, if you are only interested in the positional component of the offsetCFrame, you could use:

print(workspace.Part.CFrame + offsetCFrame.Position)

1 Like