Camera doesn't tilt, despite being told to do so

this is what’s happening right now: (compressed because devforum.roblox.com limits files to 10MB!!!)


and i nicely tell the camera to tilt to the right (or left)
sorry if this code has a lot of repetition, but i think it works :^)

local tService = game:GetService("TweenService")
local tweenParameters = TweenInfo.new(
	0.15,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out
)

local cameraFunctions = {
	FirstComboSwing = function(camera: Camera)
		local beforeShiftCFrame = camera.CFrame
		local shiftCFrame = CFrame.Angles(math.rad(3), math.rad(-3), math.rad(-45))
		local afterShiftCFrame = beforeShiftCFrame * shiftCFrame
		
		camera.CFrame = afterShiftCFrame
		
		local shiftCameraBack = tService:Create(camera, tweenParameters, {CFrame = beforeShiftCFrame})
		shiftCameraBack:Play()
	end,
	
	SecondComboSwing = function(camera: Camera)
		local beforeShiftCFrame = camera.CFrame
		local shiftCFrame = CFrame.Angles(math.rad(3), math.rad(3), math.rad(45))
		local afterShiftCFrame = beforeShiftCFrame * shiftCFrame
		
		camera.CFrame = afterShiftCFrame
		
		local shiftCameraBack = tService:Create(camera, tweenParameters, {CFrame = beforeShiftCFrame})
		shiftCameraBack:Play()
	end,
	
	ThirdComboSwing = function(camera: Camera)
		local beforeShiftCFrame = camera.CFrame
		local shiftCFrame = CFrame.Angles(math.rad(-3), math.rad(-3), math.rad(-45))
		local afterShiftCFrame = beforeShiftCFrame * shiftCFrame
		
		camera.CFrame = afterShiftCFrame
		
		local shiftCameraBack = tService:Create(camera, tweenParameters, {CFrame = beforeShiftCFrame})
		shiftCameraBack:Play()
	end,
	
	HeavySwing = function(camera: Camera)
		local beforeShiftCFrame = camera.CFrame
		local shiftCFrame = CFrame.Angles(math.rad(5), math.rad(-5), math.rad(0))
		local afterShiftCFrame = beforeShiftCFrame * shiftCFrame
		
		camera.CameraType = afterShiftCFrame
		
		local shiftCameraBack = tService:Create(camera, tweenParameters, {CFrame = beforeShiftCFrame})
		shiftCameraBack:Play()
	end,
}

local cameraManipulationModule = {}

function cameraManipulationModule.Manipulate(camera: Camera, manipulationType: string)
	cameraFunctions[manipulationType](camera)
end

return cameraManipulationModule
1 Like

i’ll bump this, but it’s not something that requires fixing, i just wanna know why the camera doesn’t tilt

1 Like

I think the problem is that the CameraType starts as Follow which keeps the camera fixed from Z-rotation. If you change the CameraType to Scriptable then you can rotate it on that axis.

This change to one of your functions temporarily sets the CameraType to Scriptable and then restores it when the Tween is completed. I think it’s getting the twist you expect with this change.

local cameraFunctions = {
	FirstComboSwing = function(camera: Camera)
		local beforeShiftCFrame = camera.CFrame
		local shiftCFrame = CFrame.Angles(math.rad(3), math.rad(-3), math.rad(-45))
		local afterShiftCFrame = beforeShiftCFrame * shiftCFrame
		local camtype = camera.CameraType
		
		camera.CameraType = Enum.CameraType.Scriptable;
		camera.CFrame = afterShiftCFrame

		local shiftCameraBack = tService:Create(camera, tweenParameters, {CFrame = beforeShiftCFrame})
		shiftCameraBack:Play()
		shiftCameraBack.Completed:Connect(function()
			camera.CameraType = camtype
		end)
	end,
}
2 Likes

i guess i’ll mark this as the solution despite not testing it, i’ll check up on this when i need to

1 Like

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