Hello, I was working at a Cusom Camera, and I got stuck at the Rotating part (When pressing MouseButton2 and moving ur mouse, ur camera will rotate), but it tilts like this:
Instead of:
(Removed bacause it have game terorist în background)
As you see, I want it like Roblox Studio’s rotation
The “Best” code:
function OnMouseMoved()
local IsButtonDown = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)
if IsButtonDown then
local CFpos = Camera.CFrame.Position
local _,position = workspace:FindPartOnRay(Mouse.UnitRay)
position = position
local Data = {CFrame = CFrame.new(CFpos,position)}
local TweenTime = 0.05
local Info = TweenInfo.new(TweenTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
local Tween = TweenService:Create(Camera,Info,Data)
Tween:Play()
Camera.CFrame = Data.CFrame
end
end
I don’t know enough math to do this