function Placement:CalcCanvas()
local canvasSize = self.CanvasPart.Size
-- want to create CFrame such that cf.lookVector == self.CanvasPart.CFrame.upVector
-- do this by using object space and build the CFrame
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)
-- use object space vectors to find the width and height
local size = Vector2.new((canvasSize * right).magnitude, (canvasSize * top).magnitude)
return cf, size
end
why is
local back = Vector3.new(0, -1, 0)
when back is supposed to be (0,0,1)
local top = Vector3.new(0, 0, -1)
when top is supposed to be (0,1,0)
local right = Vector3.new(-1, 0, 0)
when right is supposed to be (1,0,0)