Hey I’m currently working on a camera for my game and I thought it was finished, so I started working on another feature and suddenly while testing my game on the Roblox app, I noticed that everything I added to the camera was working, but it was staying in place, and even stranger, when I tried to print the position the camera was supposed to be in, it was right. I’ve run into studio/app problems before like animations not working or scripts not saving, but I really don’t understand what’s going on here. Here’s a snippet of the camera’s code:
-- Get the goal of the camera position
local CamPos = (HRP.CFrame * CFrame.new(Vector3.new(0,1.5,-.5))).Position
local Goal = CFrame.new(CamPos+CameraModule._CamOffset) * CFrame.fromOrientation(currentAngle.Y,currentAngle.X,Tilt*TiltMult)
-- Lerp the camera position to the camera goal
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Camera.CFrame:Lerp(Goal,math.clamp(CameraModule.Settings["Smoothness"]*60*dt,0,1))
--print(tostring(Camera.CFrame.Position) .. " | " .. tostring(CamPos))
RunService.RenderStepped:Connect(function(dt)
if Plr.Character then
local Char = Plr.Character
if Char:FindFirstChild("HumanoidRootPart") then
local HRP = Char.HumanoidRootPart
-- Get the goal of the camera position
local CamPos = (HRP.CFrame * CFrame.new(Vector3.new(0,1.5,-.5))).Position
local Goal = CFrame.new(CamPos+CameraModule._CamOffset) * CFrame.fromOrientation(currentAngle.Y,currentAngle.X,Tilt*TiltMult)
-- Lerp the camera position to the camera goal
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Camera.CFrame:Lerp(Goal,math.clamp(CameraModule.Settings["Smoothness"]*60*dt,0,1))
--print(tostring(Camera.CFrame.Position) .. " | " .. tostring(CamPos))
end
end
end)
(I deleted most of the code and kept only what is necessary to get the HRP)
While doing some tests I realized it probably had something to do with the framerate, everything was working fine at 60 fps but I ran rbxfpsunclocked and the camera broke again, I’m pretty sure I applied delta time to everything but I’ll check again.