I'm making a sort of over-the-shoulder(well technically over the head) action cam using "Attach" and "Enum.MouseBehavior.LockCenter," it works perfectly up to the point of the built-in zooming so I need a way to limit that if not disable it.
I've tried "Scriptable," but have no idea how to lock the camera's focus to my "Fake Head" (Which tilts up and down and syncs with the camera to account for the locked mouse) without using a while loop which will end up choppy. If the camera is focused to the fakehead every time the mouse moves, it's super smooth. But when the character moves without any mouse input, the camera just sits static.
Currently I use this bit to rotate the character and tilt the aforementioned fake head:
inputservice.InputChanged:connect(function(inputObject) local dx = inputObject.Delta.x local dy = inputObject.Delta.y --[[ With the mouse locked to the center, the magnitude and direction of dy will determine how far to tilt the fake head (along the relative x axis) and dx will turn the character (along the relative Y axis) as I have disabled AutoRotate. ]] end)
This next snippet is my artificial zooming:
--'w' is a weld object with part1 as the character's torso and part0 as the fakehead w.C0 = CFrame.new(0,-1,0) w.C1 = CFrame.new(0,0.5,0) function setzoom(z) w.C0 = CFrame.new(0,1,-z) CAM.CoordinateFrame = fakehead.CFrame * CFrame.new(0,2,8) --(0,2,8) is my desired camera position relative to the fakehead at all times. Camera zooming becomes an issue here. end MOUSE.WheelBackward:connect(function() if zoom < maxzoom-1 then zoom = zoom+1 setzoom(zoom) end end) MOUSE.WheelForward:connect(function() if zoom > minzoom+1 then zoom = zoom-1 setzoom(zoom) end end)
Basically it moves the fakehead back and forth a mousetick and syncs the camera to it (while maintaining the current tilt.)
Why does the built-in zoom feature pose an issue? Well I'm using artificial zoom to account for the locked mouse, but classic-zoom still works past my defined limit. This causes the viewport to 'jump' back to my max limit after providing a mouse input. Please send help.
tl;dr Is it possible to limit the max and min components of the built-in zoom feature using CameraType "Attach?" If not, how do I simulate "Attach" using "Scriptable" or any other CameraType? (No shiftlock please.)
EDIT: Removed parenthesis, forgot to include part1 of w
Can a mod or something close this question? I figured out you can edit the player script associated with shift-lock, set lock to true by default and remove the toggling line.