Some people said that the CFrame:ToWorldSpace and CFrame:ToObjectSpace is important, but I don’t really know how to use it or even when I should use it. I believe they are called CFrame Matrix, but I don’t know anything about it. I remember someone said about making bread sliced into 2 parts could use the ToObjectSpace function.
I only know that World space is basically the CFrame of the world and the Object space is the CFrame of a specific object.
I’ve did some research on google, read the DevHub, watched some Youtube videos about it. And I still have hard time understanding it. But, like after I did those researches, I got this:
local Part = workspace:WaitForChild("Part")
local A = workspace:WaitForChild("A")
print(Part.CFrame:ToWorldSpace(A.CFrame)) -- prints how far is it (on the x, y, z axis) from the center of the world/ prints the position relative to the center of the world,
-- subtract the World CFrame from the Part CFrame
-- A.CFrame will be relative to the Part.CFrame
print(Part.CFrame:ToObjectSpace(A.CFrame)) -- treating the Part as the center of the world
-- subtract the Part CFrame from the A CFrame
I also don’t know how to use the parameter for the function too and how is ToWorldSpace() the same as CFrame * CF. Also, how is ToObjectSpace() the same as CFrame:Inverse() * CF