im trying to make a simple camera system that works like the “Custom” camera type but without a camerasubject, but i cant work with cframes to make it rotate correctly
local Delta = UIS:GetMouseDelta()
local NewCF = CFrame.Angles(math.rad(Delta.Y),math.rad(Delta.X),0)
Cam.CFrame = Cam.CFrame:ToWorldSpace(NewCF)
this is the movement, no matter how i move the delta.x and delta.y it wont work so theres probably something wrong with how i change the cframe.
This works with the Scriptable camera type (if that’s what you want).
Try this (not mine):
local dx, dy = 0, 0 -- in degrees
local MouseSensitivity = 0.1
local UserInputService = game:GetService("UserInputService")
local Mouse = game.Players.LocalPlayer:GetMouse()
local Cam = workspace.CurrentCamera
function UpdateModel()
cam.CFrame = cam.CFrame:lerp(CFrame.new(Cam.CFrame.Position)
* CFrame.fromOrientation(math.rad(dx), math.rad(dy),0),0.1) -- Change lerp if u want
end
function MouseMove()
local Delta = UserInputService:GetMouseDelta()
dx += Delta.Y * MouseSensitivity
dy += Delta.X * MouseSensitivity
UpdateModel()
end
function MouseDown()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
end
function MouseUp()
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
Mouse.Move:Connect(MouseMove)
Mouse.Button1Down:Connect(MouseDown)
Mouse.Button1Up:Connect(MouseUp)