What is the difference between these two CFrames?

Can anyone explain to me why

centerCFrame * CFrame.Angles(angle, 0, 0) * centerCFrame:Inverse() == CFrame.Angles(angle, 0, 0)

returns false?

And so does this:

centerCFrame * CFrame.Angles(angle, 0, 0) * centerCFrame:Inverse() == centerCFrame * centerCFrame:Inverse() * CFrame.Angles(angle, 0, 0)

Thanks!

This is incorrect. You need to add ()

It seems to have been cut off when copy pasting :sweat_smile:
Fixed :D

The order of CFrame multiplication will change the resulting CFrame. It would be better to check the operations one by one

For the first example:

centerCFrame * CFrame.Angles(angle, 0, 0) * centerCFrame:Inverse()

I’m gonna use drawings to explain.

Starting with the origin
image
The blue circle is the origin and red is the cframe

Let’s say centerCFrame is some units forward and angle is an angle going right

This is what centerCFrame will look like
image

If you multiply by CFrame.Angles(angle,0,0), you will rotate the cframe like this
image

Then multiplying by centerCFrame:Inverse() will make it move opposite of forwads, which is backwards.
image

Remember, when you multiply CFrames, the product is relative to the CFrames. This means, the red arrow moved backwards relative to its rotation.

So what happened is you moved backwards after you rotate, meaning you will not be back at the origin anymore. When you compare it with just CFrame.Angles(angle,0,0), it won’t be equal because the resulting cframe has moved while the other is just rotation.

Same with the second equation

centerCFrame * CFrame.Angles(angle, 0, 0) * centerCFrame:Inverse() == centerCFrame * centerCFrame:Inverse() * CFrame.Angles(angle, 0, 0)

The first part is the same, but the second has an extra operation centerCFrame * centerCFrame:Inverse(). This specific operation will cancel each other out because they are the exact opposites of each other, leaving only the CFrame.Angles(angle,0,0). This one is already discussed previously in the first equation.

1 Like