# CFrame:Inverse not working as intended?

To my knowledge, if CFrame was like 2, 2, 0, Inverse would be -2, -2, 0

But with my example, CFrame is (rounded) 1, 6, 0 but the inverse is returning 0, -1, -6??

``````local Inverse = Camera.CFrame:Inverse()
print("CAM", Camera.CFrame.Position)
print("INV", Inverse.Position)
``````
``````  21:46:13.387  CAM 0.99890559911728, 6.0043773651123, 0
21:46:13.387  INV 0, -0.99890559911728, -6.0043773651123
``````
1 Like

This should not be happening. Try printing something simple in the command line. For example: `print(CFrame.new(-2,-5,7):Inverse().Position)`. It should return `2, 5, -7`. If it doesn’t then you most likely have a bug or some other error on your hands.

I tried this

``````local C = CFrame.new(2, 2, 0)
local I = C:Inverse()

print(C)
print(I)
``````

and it worked as intended. But there should be no reason why mine isn’t working. There’s literally no code between the inverse and the prints

Strange. Maybe try doing this and seeing if it works? I doubt it will, but you can try it.

``````local camFrame = Camera.CFrame

print("CAM: ", camFrame.Position)
print("INV: ", camFrame:Inverse().Position)
``````

The key here is that the C, CFrame has no rotation.

If you were to rotate it let’s say 90 degrees.

``````local C = CFrame.new(2, 2, 0)*CFrame.Angles(0,math.deg(90),0)
local I = C:Inverse()

print(C)
print(I)
``````

It’s going to be a lot different:

``````  22:17:35.547  2, 2, 0  -  Edit
22:17:35.547  0.59910517930984, -2, 1.9081596136093  -  Edit
``````

I don’t rotate the camera at all?

I do have a tween that plays, and my prints are being printed in a while loop, so it constantly gets up to date info. But this shouldn’t cause any differences in the inverse

``````local CameraInTween = TweenService:Create(
Camera,
TweenInfo.new(0.5),
{
CFrame = Camera.CFrame - Vector3.new(-1, 4, 0)
}
)
``````

Waiiitt a minute… if you are using the positions then can’t you just do `-Camera.CFrame.Position`?

No, I just printed the .Position, cause I didn’t really want the print to be filled with a bunch of extra numbers.

Alright, I just searched and found this answer:

You might have to have some knowledge of matrices to understand everything this is saying. If you don’t understand matrices you can try learning about them here.

Because CFrames are really just inverses, I’m guessing that that the inverse is the same as the Inverse of a Matrix.

Honestly, I completely forgot that CFrames were matrices. That’s my bad. You can try checking out the resources below.

It might take you awhile to understand if this is all new to you. Instead, can you tell me what exactly you are trying to accomplish by using the inverse?