Hello! Im making a shooting game where the cameras are fixed… only third person or (with a button) you change to first person camera. The problem is when you move the camera it always starts from x = 0 and y = 0… I’d like to start from the orientation of the humanoid root part but I cant figure it out
this is what I have
local x,y = 0,0
local function touchStarted(input, gameProcessed)
if gameProcessed == false then
dragStart = input.Position
end
end
local function update(input, gameProcessed)
if gameProcessed == false then
local delta = input.Position - dragStart
x = delta.X / 100
y = math.clamp(y-(delta.Y / 10000), -1, 1)
end
end
UserInputService.TouchMoved:Connect(update)
UserInputService.TouchStarted:Connect(touchStarted)
RunService.RenderStepped:Connect(function()
local getCameraRot = CFrame.new(hrp.Position) * CFrame.Angles(0, -x, 0) * CFrame.Angles(y, 0, 0)
Camera.CFrame = getCameraRot * CFrame.new(2, 3, 5)
hrp.CFrame = CFrame.new(hrp.CFrame.p) * CFrame.fromEulerAnglesXYZ(0, -x, 0)
end)