Need help with mouse sensitivity when implementing zoom in scope

Hello community.

Can i request that you kindly help me?

I am trying to implement a zoom in scope and i am using the roblox example. I am having problem with the mouse sensitivity. When zoomed in, a slight move of the mouse will result in a big shift and disorientate the entire view. I understand that the below controls the mouse but i cant modify it properly.

local cameraAngleX = 0
local cameraAngleY = 0
local function moveInput(actionName, inputState, inputObject)
if not isZoomed then return end
if inputState == Enum.UserInputState.Change then
cameraAngleX = math.clamp(cameraAngleX-inputObject.Delta.X*0.4, -90, 90)
cameraAngleY = math.clamp(cameraAngleY-inputObject.Delta.Y*0.4, -75, 75)
local camPosition = rootPart.CFrame:ToWorldSpace(CFrame.new(0, 2, -2))
local camRotation = camPosition * CFrame.Angles(0, math.rad(cameraAngleX), 0) * CFrame.Angles(math.rad(cameraAngleY), 0, 0)
target = camRotation:ToWorldSpace(CFrame.new(0, 0, -20))
camera.CFrame = CFrame.new(camRotation.Position, target.Position)
camera.Focus = CFrame.new(target.Position)
end
end

Also can i confirm the below code controls the amount of zoom?

target = rootPart.CFrame:ToWorldSpace(CFrame.new(0, 2, -20))

thank you!

1 Like

If you want to change sensitivity you can just manually change it by setting this property of the user input services upon zooming to make less sensitive or more sensitive.

5 Likes