CFrame.fromMatrix always erring as nil value

Whenever I attempt to construct a CFrame using CFrame.fromMatrix, it throws an attempt to call field 'fromMatrix' (a nil value) error. I’m filling all the parameters with the required Vector3s but I can never get past the line of code without it erring. Does anyone suppose that this is a bug with the constructor itself?

1 Like

fromMatrix is not a method of CFrame. What you are looking for is

CFrame.new(number x, number y, number z, number R00, number R01, number R02, number R10, number R11, number R12, number R20, number R21, number R22)

http://wiki.roblox.com/index.php?title=CFrame#CFrame.new

1 Like

CFrame.fromMatrix is a constructor documented on the developer hub. I really don’t know if it’s actually deprecated or something new and not yet enabled, it’s very rarely mentioned on the devforum.

I do know about the full length matrix constructor, I just wish it wasn’t so messy. This explains why it’s erring as nil but now I’m mixed up about the very existence of CFrame.fromMatrix.

I’d imagine it’s new but not in production yet and was accidentally included in documentation. Would be nice to know the actual reason since it shows up in studio too, weird.

You can lay out the method in a way which is somewhat pleasing.

CFrame.new(x,   y,   z, 
           R00, R01, R02, 
           R10, R11, R12, 
           R20, R21, R22)
2 Likes

Yeah, I suppose I can assume it’s just not implemented yet and use the original matrix constructor. Thanks for your help.