Ok So Im Making A Doom 1993 Like Game And I Need Help Because Of Camera Stuff:
What do you want to achieve? I Want To Make The Y Rotation Of The Camera Fixed Like You Cant Rotate The Camera Up And Down Like Doom 1993, I Saw Some Games Do It So I Know Its Possible
What is the issue? I Have No Idea In How To Do That
What solutions have you tried so far? I Tried Looking On The DevForum But No Luck, Not Even In Youtube, I Tried Using CFrames But It Looked Like A Wash Machine
local runService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local function renderStepped()
local rotation = (camera.CFrame - camera.CFrame.Position)
local rx, ry, rz = rotation:ToOrientation()
camera.CFrame = camera.CFrame * CFrame.Angles(rx, 0, rz)
end
runService.RenderStepped:Connect(renderStepped)
Sorry for repost, I accidentally replied to someone else lmao
I’m confused about what you mean. Is it in the wrong direction? Try switching out the 0:
local runService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local function renderStepped()
local rotation = (camera.CFrame - camera.CFrame.Position)
local rx, ry, rz = rotation:ToOrientation()
camera.CFrame = camera.CFrame * CFrame.Angles(rx, ry, 0)
end
runService.RenderStepped:Connect(renderStepped)
i tried but its the same thing, i cant record but imagine a camera rotating at INSANE speed, its what happen, the only thing that changes its the direction that it rotates
First cam.CFrame line replaces the Y axis of cam by subtracting the current value and adding the value of the camera focus, so its at the same height as the focus. Second line tells the camera to face forward but ignore any Y component. guard is required otherwise changing the CFrame will call the function again in an infinite loop.