Confused about :ToWorldSpace and :ToObjectSpace arguments

Hello!

I’m a little confused about the arguments of :ToWorldSpace and :ToObjectSpace as I am having trouble getting consistency.

So, let’s say I have 2 CFrames, one is called “plotCFrame” where an object would be placed, and another one would be “partCFrame”, the part that would be placed.

local plotCFrame = CFrame.new(100,10,100)
local partCFrame = CFrame.new(10,0,10)

-- Now, to place the part relative to the plot, would I do
part.CFrame = plotCFrame:ToObjectSpace(partCFrame)
-- or
part.CFrame = partCFrame:ToObjectSpace(partCFrame)
1 Like

This should be correct as it will apply partCFrame to the object space of plotCFrame.

1 Like

:ToWorldSpace is the opposite of :ToObjectSpace (to set a CFrame relative to another). For example, I would use :ToObjectSpace for offsetting a part relative to another part (this works even if the other part is rotated). I recommend you to this: Object and World Space | Roblox Creator Documentation. I recommend this article for more information on CFrame: CFrames | Roblox Creator Documentation.

1 Like