CFrame :Inverse()

What’s the difference between

B.CFrame:Inverse() * A.CFrame
--which I know is the same as B.CFrame:toObjectSpace(A.CFrame)

as compared to

A.CFrame * B.CFrame:inverse()

Like I can visualize the first way but I don’t understand why you would do the second way.

Ok this is definitely not the answer.

1 Like

I mean, you are asking what the difference is. @Protori answered that question for you which is there is no difference. Multiplication is commutative. A * B = B * A

1 Like

CFrame multiplication is not commutative. This means that a * b is not necessarily equal to b * a.

The only case where this doesn’t apply is multiplying a CFrame with its own inverse, which isn’t the case here.

From CFrames | Documentation - Roblox Creator Hub

cc @Protori

5 Likes

From the Reverting to Original Values part of the wiki page:

Given that cf = cf1 * cf2, the following can be said

cf1:inverse() * cf = cf2

Derivation
  1. cf = cf1 * cf2
  2. cf1:inverse() * cf = cf1:inverse() * cf1 * cf2 – pre-multiply both sides by cf1:inverse()
  3. cf1:inverse() * cf = CFrame.new() * cf2 – recall cf:inverse() * cf = identityCFrame
  4. cf1:inverse() * cf = cf2 – recall identityCFrame * cf = cf

cf * cf2:inverse() = cf1

Derivation
  1. cf = cf1 * cf2
  2. cf * cf2:inverse() = cf1 * cf2 * cf2:inverse() – post-multiply both sides by cf2:inverse()
  3. cf * cf2:inverse() = cf1 * CFrame.new() – recall cf * cf:inverse() = identityCFrame
  4. cf * cf2:inverse() = cf1 – recall cf * identityCFrame = cf

Since in cf = cf1 * cf2, cf is the resultant CFrame obtained when original CFrame cf1 is offset by CFrame cf2,
cf * cf2:inverse() will give you the original CFrame.

So if you know the resultant CFrame and the offset, the original CFrame can be calculated using original = resultant * offset:Inverse()

I have no real usage in mind and can’t see anything concerning this anywhere either

3 Likes