I’m considering reporting this as a bug, which is why I’m giving this it’s own thread to weigh in on others experiences…
Basically, when I use a non vector_origin position on a view model and I’ve been connected to a server for more than a few hours ( in this case about 9-10 ) the sway variables cause the weapon to SHAKE. When I hold sprint, it increases those variables to 1.25 and it looks like the weapon is having a seizure.
I’m using the base weapon_cs_base GetViewModelPosition code, separated into functions and extended to where it no longer relies on +/- m to achieve fluid motion. I am using a NumberApproach function to solve the problem of shifting the model position and angle based on the d/T and the time it should take to shift resulting in the motion being fluid from any part of the screen to any other part on the screen meaning actions can be interrupted with grace just by giving it new coordinates i.e. holding sprint lowers the weapon, letting go of sprint returns it to either the lowered position, hip position, or iron sight position depending where it was being held at the time.
This, and this alone causes the shakiness of the weapon. I could write my own method of sway and bob using math.sin or math.cos on the position to achieve the same effect, but it’s already implemented so I’m trying to find a solution to an existing problem before reinventing the wheel.
[lua]function SWEP:UpdateViewModelSway( sway, bob )
self.SwayScale = sway
self.BobScale = bob
Edit: I am able to reproduce it by idling for ~34 minutes. ( [AcecoolDev]-GameMode Refreshed. You’ve been here for [00:33:38]. )
The second issue, is that when the server is up for an extended period and you are connected for an extended period, smooth motion is no longer possible. I have a green bar on my debug hud that increases based on a direct correlation with velocity – it becomes shaky the longer the server is open.
Reconnecting to the server does not resolve both issues. Restarting the level does not resolve the issues. Restarting Garry’s Mod, does not resolve the issues.
Closing SRCDS and re-launching does resolve all issues – I find this part strange as the hud should exist only on the client, as the client should be a sort of “viewer/reader”. And I find it strange that the server would control the shakiness of the weapon - that should be done locally.
Edit: Again, it started shaking at the same time: [AcecoolDev]-GameMode Refreshed. You’ve been here for [00:33:35]. – Once I noticed it I edited and saved a file to grab a time… It doesn’t shake until this time into it. And restarting a server every 30 minutes is …