Camera position is set to (0,0,0) when using CFrame

I have been trying to rotate the camera using CFrame.Angles()
but instead of rotating, it moves to position (0,0,0)

Am I missing something?
How can I fix this?

local Camera_Action = {CFrame = CFrame.Angles(math.rad(0), math.rad(-20), math.rad(0))}
TweenService:Create(Camera, Tween_Info, Camera_Action):Play()

Your not specifying the position of the Camera, only the Orientation, so you would have to multiply the Camera CFrame and the CFrame.Angles together.

local Camera_Action = {CFrame = Camera.CFrame * CFrame.Angles(math.rad(0), math.rad(-20), math.rad(0))}
1 Like

I already tried this, and it doesn’t seem to work correctly.
This time the initial positions of the camera and the final ones are printed, perhaps this information can be useful.

try this, its a cleaner version of yours:

local newCFrame = Camera.CFrame * CFrame.Angles(math.rad(0), math.rad(-20), math.rad(0))
local Camera_Action = TweenService:Create(Camera, TweenInfo, {
    CFrame = newCFrame
})
Camera_Action:Play()

If this doesn’t work, show me your whole camera script.

Make sure you have the Camera’s CameraType set to Scriptable before making any changes. This way you can set custom behaviors for it.
Camera.CameraType = Enum.CameraType.Scriptable

Also make sure you grab the Camera’s current CFrame and multiply that with your CFrame angle as others have previously stated.

2 Likes

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