wiremod / wire

Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.
http://www.wiremod.com
Apache License 2.0
552 stars 332 forks source link

Cam controller with "free movement" checked changes speed drasticly depending on fps #2685

Open dstmnaki opened 1 year ago

dstmnaki commented 1 year ago

When using a cam controller with "free movement" checked, the lower your fps the faster the camera rotates, at 60 fps it seems to behave normally, but going towards 30 fps and it's twice as fast, lower as you might have guessed makes it beyond controllable

Steps to reproduce the behavior:

  1. Check "client side movement" and "free movement" on the cam controller and wire it up just so that you can look around
  2. Create fps lag, or limit your fps to lower than 60 using fps_max command
  3. look around
  4. compare it with 60 fps and you will see the difference

I assume that the speed should not change depending on client's performance in this way, it should move at the same rate regardless of fps

thegrb93 commented 1 year ago

I think it's because the LerpAngle happening iteratively is effectively producing an exponential to the target. Using FrameTime as a multiplier is thus non-linear with framerate. I don't remember the exact math but I think it needs to be math.sqrt(FrameTime())

Fasteroid commented 1 month ago

I think it's because the LerpAngle happening iteratively is effectively producing an exponential to the target. Using FrameTime as a multiplier is thus non-linear with framerate. I don't remember the exact math but I think it needs to be math.sqrt(FrameTime())

it's 1 - Math.pow(0.95, dt)