I’m trying to make the camera rotate slightly with the user mouse, but i suck at math:
i made this code but he doesnt work
local Camera = workspace.CurrentCamera
local MOUSE = game.Players.LocalPlayer:GetMouse()
local FirstCF = Camera.CFrame
local function UpdateCamera()
local MOUSE_POS = Camera:ViewportPointToRay(MOUSE.X,MOUSE.Y)
local RAY = Ray.new(MOUSE_POS.Origin,MOUSE_POS.Direction * 500)
local TargetName,CoordsHit= workspace:FindPartOnRay(RAY)
-- print(target,hit)
Camera.CFrame =FirstCF * CFrame.new(workspace.MenuVillanPart.Position,CoordsHit)
end
game:GetService("RunService").RenderStepped:Connect(UpdateCamera)
ik that Ray Cast is not the best way but as i said i suck at math