Attempt to perform arithmetic (div) on CFrame

  1. What do you want to achieve? Keep it simple and clear!
    I would like to divide cframe by another cframe, however it returns an error saying I can’t. They are multiplied or divided by the same exact multiplier, but division does not work.

  2. What is the issue? Include screenshots / videos if possible!
    Attempt to perform arithmetic (div) on CFrame

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried looking on DevForum, found nothing to answer my question

-- this works
Camera.CFrame = Camera.CFrame * Camera.Multiplier.Value

-- this doesn't
Camera.CFrame = Camera.CFrame / Camera.Multiplier.Value

Thanks in advance :slight_smile:

You can’t, that’s not a thing. Read up on linear algebra to find out why, if you want to. It’s not important tho.

The way you “do the opposite of multiplying by a CFrame” is to instead multiply by the inverse of that CFrame. It’s similar to how division is the same as multiplication by the reciprocal. E.g. 2/3 = 2 * 1/3.


local cfA = --some CFrame value
local cfB = --some CFrame value
local aTransformedByB = cfA * cfB
local aCalculatedFromATransformedByB = aTransformedByB * cfB:Inverse() --Undo the transformation
print(cfA == aCalculatedFromATransformedByB) --true, except floating point error might make them only approximately equal

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.