How can I sorta understand CFrame.fromMatrix

I’m trying to make a placement system and I’m having trouble understanding what frommatrix is

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

local cf = self.CanvasPart.CFrame * CFrame.fromMatrix(-back*canvasSize/2, right, top, back) -- What does from matrix even do? I read on the wiki it creates a cframe???
local size = Vector2.new((canvasSize * right).magnitude, (canvasSize * top).magnitude)

The code is from here

theres already a post for it

2 Likes

CFrame.fromMatrix is a different way of using CFrame.new(position, lookVector)

It does this: CFrame.fromMatrix(position, vectorX, vectorY, vectorZ)

Vector X would be the position the X axis of the part will look at.
Vector Y and Vector Z does the same.

So basically if you already have a “notion” of vector3 then this would be easy to understand:

CFrame.fromMatrix(Vector3 pos, Vector3 vX, Vector3 vY , Vector3 vZ)

pos: Position the part will be at.

vX = Where the part’s X axis will be looking at.

vY = Where the part’s Y axis will be looking at.

vZ = Where the part’s Z axis will be looking at.

3 Likes

You may want to read this, and then read this.