Hi! So I’ve been working on a custom shiftlock, and its been going pretty well. i have pretty much everything finished, only one thing. I locked the mouse in the center with
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
but this only locks the mouse. I want it to also rotate the camera while its locked without having to hold right click. Thanks!
Hi! To make the camera rotate without holding right-click, you can use the UserInputService and modify the Camera’s CFrame. Here’s a simple solution to rotate the camera while the mouse is locked in the center
local UIS = game:GetService("UserInputService")
local camera = game.Workspace.CurrentCamera
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
local lastMousePosition = UIS:GetMouseLocation()
UIS.InputChanged:Connect(function(input)
if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter then
local delta = UIS:GetMouseDelta()
local cameraRotation = camera.CFrame.Rotation
camera.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.Angles(0, -delta.X * 0.005, 0)
end
end)
Just give it a try, hopefully it works. That’s all I got, can’t really offer more than that.