A question about CFrame

So I was going through some posts to learn OOP and I found @EgoMoose post around 3 years ago about making a placement module using OOP and I really got confused at the part where it says

local back = Vector3.new(0, -1, 0)
	local top = Vector3.new(0, 0, -1)
	local right = Vector3.new(-1, 0, 0)

	-- convert to world space
	local cf = self.CanvasPart.CFrame * CFrame.fromMatrix(-back*canvasSize/2, right, top, back) ​

Alright so I do know that CFrame.fromMatrix() is just setting the position of the CanvasPart and then rotating the faces so there for example the back will face the lookVector etc, theres 2 things I dont understand, one is why is local back = Vector3.new(0, -1, 0) and not Vector3.new(0,0,1) and why is local top also not Vector3.new(0, 1, 0) the other question is that why do we even need to rotate the faces using fromMatrix and cant we just use CFrame.Angles or rotate them from the beginning, this may sound like something dumb but I really wasnt trying to get in the depths of CFrames before but I really need them now, sorry for the bother and thanks!

I can’t speak specifically about the reasons (0,-1,0) would be used for the upVector in EgoMoose’s post. You are right in your understanding that a part with rotation matching the world would have an upVector of (0,1,0). You definitely do not need to use CFrame.fromMatrix(). Like the other constructors, its exists for cases where it might be more practical to use it over the other ones. My personal preference is to use CFrame.fromAxisAngle().

1 Like