I have a script that rotates the camera based on the vehicle the player is standing in. It works for the most part, but I’ve noticed that based on how up or down you are looking, the faster you spin, meaning the player’s orientation becomes desynced with the vehicle.
I’ve tried rotating based on world space but it doesn’t seem to work(CFrames are not my strength lol)
This is the code in the video, simplified to show the problem:
local runService = game:GetService("RunService")
local camera = workspace.CurrentCamera
runService.Heartbeat:Connect(function(dt)
camera.CFrame = camera.CFrame:ToWorldSpace(CFrame.Angles(0,dt,0))
end)
Don’t know if this is wrong, but in games like Minecraft, when the player looks up there is a drastic increase in frame rate. Considering RunService.Heartbeat is frame relative, that might be what is happening
I don’t think delta time is the reason it’s speeding up, but rather how often the connection is being fired. The Roblox docs say that if a player’s frame rate is 40 FPS, Runservice Heartbeat will fire 40 times per second. When the player looks up, they have an increase in frame rate(let’s say to 60 fps), and now Runservice Heartbeat will fire 60 times a second, meaning the player’s camera will rotate faster. RunService | Documentation - Roblox Creator Hub
Delta time is not the reason it is speeding up, my framerate remains the same. It is due to the angle of the camera and multiplying cframes, but I don’t know how to fix this