What is ```CFrame:Inverse()```?

Hello, I am confused about what CFrame:Inverse() is, please explain or provide any links that I can read. Thanks. :slight_smile:

12 Likes

CFrames are represented by an underlying transformation matrix, and calling CFrame:Inverse() just returns the inverse of the matrix :slight_smile:

Usage of the inverse is subjective, but an important fact you should know is that a CFrame multiplied by its inverse ALWAYS returns the Identity CFrame (CFrame.new()).

2 Likes

Think of CFrame1 * CFrame2 as A + B and CFrame1 * CFrame2:inverse() as A - B. The difference is simply addition and subtraction.

To elaborate; if CFrame2 was something like CFrame.new( 2, -3, 4) then the :inverse of CFrame2 would be equivalent to CFrame.new( -2, 3, -4).

120 Likes

Amazing and simple explanation! Thank you!

2 Likes

Wow that’s the simplest way to think about and it should work most of the time.

(Simple relative to the long maths of the dev article)

However, we have to remind ourselves that CFrames are not commutative contrary to the multiplication and the addition symbols in the math portray.

Yeah…check my post history in scripting support for some CFrame failures…

Edit: Specifically this one lol, be wary of the CFrame rotation you obtained if it is relative to object terms or world terms, I got it relative to world terms.

3 Likes

It only works when the rotation is the identity matrix, which is the default for CFrame.new:

1 0 0
0 1 0
0 0 1

Otherwise, the inverse CFrame’s position isn’t just -CFrame.Position

2 Likes