i hate camera manipulation
i’ll just include a video of what happens
and this is the code;
local rService = game:GetService("RunService")
local scalingFactor = 0.01
local cameraFunctions = {
FirstComboSwing = function(camera: Camera, char: Model)
local head = char:FindFirstChild("Head")
local originalCFrame = camera.CFrame
local relativeOffset = Vector3.new(-3, -0.5, 0)
local targetLookAtPosition = head.CFrame:PointToWorldSpace(relativeOffset * scalingFactor)
local targetCFrame = CFrame.lookAt(camera.CFrame.Position, targetLookAtPosition)
camera.CFrame = targetCFrame
end,
SecondComboSwing = function(camera: Camera, char: Model)
local head = char:FindFirstChild("Head")
local originalCFrame = camera.CFrame
local relativeOffset = Vector3.new(3,0.5,0)
local targetLookAtPosition = head.CFrame:PointToWorldSpace(relativeOffset * scalingFactor)
local targetCFrame = CFrame.lookAt(camera.CFrame.Position, targetLookAtPosition)
camera.CFrame = targetCFrame
end,
ThirdComboSwing = function(camera: Camera, char: Model)
local head = char:FindFirstChild("Head")
local originalCFrame = camera.CFrame
local relativeOffset = Vector3.new(-3, -0.5, 0)
local targetLookAtPosition = head.CFrame:PointToWorldSpace(relativeOffset * scalingFactor)
local targetCFrame = CFrame.lookAt(camera.CFrame.Position, targetLookAtPosition)
camera.CFrame = targetCFrame
end,
HeavySwing = function(camera: Camera, char: Model)
local head = char:FindFirstChild("Head")
local originalCFrame = camera.CFrame
local relativeOffset = Vector3.new(0.5, -0.5, 0)
local targetLookAtPosition = head.CFrame:PointToWorldSpace(relativeOffset * scalingFactor)
local targetCFrame = CFrame.lookAt(camera.CFrame.Position, targetLookAtPosition)
camera.CFrame = targetCFrame
end,
}
local cameraManipulationModule = {}
function cameraManipulationModule.Manipulate(camera: Camera, manipulationType: string, char: Model)
cameraFunctions[manipulationType](camera, char)
end
return cameraManipulationModule