Reproduction Steps
- Play Solo with latest default camera scripts.
- Use Gamepad thumbstick to rotate camera, observe the speed at which it rotates
- Lower your FPS… perhaps
for i = 1, 10000 do local p = Instance.new("Part") p.CFrame = CFrame.new(math.random() * 100, 100, math.random() * 100) p.Parent = workspace end
- Use Gamepad thumbstick to rotate camera, observe how much slower it rotates
Expected Behavior
Camera should rotate at constant rate no matter what the framerate is
Actual Behavior
Camera does not respect frame dt, and moves incredibly slow. This affects ALL GAMES. If someone is playing on a low end/older Xbox, for example, which has low FPS on many games, the camera will rotate annoyingly slow. From looking at code, I would presume this also happens on mobile. Whoever wrote the code only correctly implemented for keyboard LEFT/RIGHT rotation.
Workaround
File: PlayerModule.CameraModule.CameraInput
Lines: around 165-168 in latest version
Line 164, local kKeyboard = Vector2.new(keyboardState.Right - keyboardState.Left, 0)*worldDt
correctly multiplies by worldDt. But, for some reason when this was written, kGamepad
, kMouse
, kPointerAction
, kTouch
do not respect worldDt.
Subsequently, after making this change and multiplying by worldDt, it can be presumed that the remaining variables ROTATION_
variables at top (besides _KEYS
because it already respected worldDt) should be multiplied by 60.
In the latest version, these variables look like this.
local ROTATION_SPEED_KEYS = math.rad(120) -- (rad/s)
local ROTATION_SPEED_MOUSE = Vector2.new(1, 0.77)*math.rad(0.5) -- (rad/s)
local ROTATION_SPEED_POINTERACTION = Vector2.new(1, 0.77)*math.rad(7) -- (rad/s)
local ROTATION_SPEED_TOUCH = Vector2.new(1, 0.66)*math.rad(1) -- (rad/s)
local ROTATION_SPEED_GAMEPAD = Vector2.new(1, 0.77)*math.rad(4) -- (rad/s)
You can see how ROTATION_SPEED_KEYS
is a normal number… 120 degrees/second, because it properly respects worldDt. But all the others, such as ROTATION_SPEED_GAMEPAD
… 4 degrees/second?? Definitely not. It obviously rotates much faster than this intended value, as it should, because 4 degrees/second would be extremely slow. At normal update rate, it actually likely rotates at more like 240 degrees/second, 4*60fps, right now. Which it should. But needs to respect dt.
Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Constantly