#Shaky camera

5 messages · Page 1 of 1 (latest)

zealous lodge
#

so i tried to make a custom shift lock for my project, that work similar to roblox shiftlock but with left control instead

slight problem is the camera shake violently when moving backward and kind of snap a bit off where it's suposed to be when i move sideways

i don't think the script is at fault here since i've made sure it's the camera shaking and not the character but here is the script anyways

local Input = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local player:Player = game:GetService("Players").LocalPlayer
local Locked = false
local RenderSteppedCamera

-- Make the camera behave like shift lock when control is pressed 
Input.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.LeftControl and player.Character and player.Character.Humanoid.Health > 0 then
        Locked = not Locked
        if Locked then
            Input.MouseBehavior = Enum.MouseBehavior.LockCenter
            player.Character.Humanoid.CameraOffset = Vector3.new(1.75, 0.25, 0)
            RenderSteppedCamera = RunService.RenderStepped:Connect(function()
                local hrp = player.Character.HumanoidRootPart
                local camera = game.Workspace.CurrentCamera
                local cameraYaw = math.atan2(camera.CFrame.LookVector.X, camera.CFrame.LookVector.Z) + math.pi  -- Add 180-degree offset
                hrp.CFrame = CFrame.new(hrp.Position) * CFrame.Angles(0, cameraYaw, 0)
            end)
        else
            Input.MouseBehavior = Enum.MouseBehavior.Default
            player.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0)
            RenderSteppedCamera:Disconnect()
        end
    end
end)

im using a custom character not my default one for testing, and it seems to behave a bit weird, i'll post a second video to show what i mean by that

#

i think it's because of a property or maybe just because it's a custom character

fluid ledge
#

enable massless

zealous lodge