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:

9 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()).

1 Like

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).

105 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.

2 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

1 Like