trying to mimic gta IV ragdoll camera, works overall but i just need help preventing the zoom
code:
RunService.RenderStepped:Connect(function(dt)
if char:FindFirstChild("Ragdolled") and char.Ragdolled.Value == true then
if not usingRagdollCamera and settingValue.Value == false then
usingRagdollCamera = true
originalCameraType = workspace.CurrentCamera.CameraType
originalCameraSubject = workspace.CurrentCamera.CameraSubject
cameraRig = Instance.new("Part")
cameraRig.Size = Vector3.new(1,1,1)
cameraRig.Anchored = true
cameraRig.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(0, math.clamp(torso.AssemblyLinearVelocity.Magnitude / 350, 0, 3), 0)
cameraRig.CanCollide = false
cameraRig.CanTouch = false
cameraRig.CanQuery = false
cameraRig.Transparency = 1
cameraRig.Name = "CameraRig"
cameraRig.Parent = char
workspace.CurrentCamera.CameraSubject = cameraRig
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end
if usingRagdollCamera and cameraRig then
local currentPos = torso.Position
local velocity = (currentPos - lastPos) / dt
lastPos = currentPos
local drag = -0.2
local offset = -velocity * drag
if offset.Magnitude > 15 then
offset = offset.Unit * 15
end
local targetPos = torso.Position + offset
local newY = math.clamp(torso.AssemblyLinearVelocity.Magnitude / 350, 0, 3)
TweenService:Create(cameraRig, TweenInfo.new(0.3), {
Position = targetPos + Vector3.new(0, newY, 0)
}):Play()
end
else
if usingRagdollCamera then
resetCamera()
end
end
end)
** You are now Level 1! **