Silly me. It was an easy problem!
1 Like
I suppose this has something to do with the ordering of CFrame angles. Try fromEulerAnglesYXZ
instead of Angles
.
At line 15, I found that multiplying X by 2 was causing the issue but for me multiplying X by 0 and clamping Y of minimum -50 fixed the issue for me. but Iām not sure if this is the way you want the camera to behave.
local LookCF = HeadCF*CFrame.Angles(-math.rad(CamAngle.Y),-math.rad(CamAngle.X),0):Inverse()*CFrame.new(2,3,5)
fixed code
local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local CamAngle = Vector2.new(0,0)
Camera.CameraType = Enum.CameraType.Scriptable
local function Update(dt)
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
local HeadCF = CFrame.new(Head.Position)
local LookCF = HeadCF*CFrame.Angles(-math.rad(CamAngle.Y),-math.rad(CamAngle.X),0):Inverse()*CFrame.new(0,3,5)
Camera.CFrame = CFrame.new(LookCF.Position,HeadCF.Position)
end
RS.RenderStepped:Connect(Update)
UIS.InputChanged:Connect(function(Input, GPE)
if Input.UserInputType == Enum.UserInputType.MouseMovement then
local Delta = UIS:GetMouseDelta()
local X = CamAngle.X - Delta.X
local Y = CamAngle.Y - Delta.Y
Y = math.clamp(Y, -50, 89)
CamAngle = Vector2.new(X,Y) * UIS.MouseDeltaSensitivity
end
end)
Definitely not the solution because i previously did that.
To @Y_VRN.
Ill test it tomorrow i got an idea.
1 Like
Fixed it. I just used this persons Cool FPS camera script for horror, fps, adventure games that is my alt accounts code that I previously made and forgot. Thanks for the help!