GetViewModelPosition Runs Slower/Faster depends on client's ping
8 replies, posted
GetViewModelPosition Runs Slower/Faster depends on client's ping
Do you know what the hell is going on?
300 MS
[t]http://i.imgur.com/2rfIi9C.png[/t]
0 MS
[t]http://i.imgur.com/dVbdRqq.png[/t]
Well, if the code is executed in one thread, line by line and some code relies on ping then it could slow down all other calls which is why we have FrameTime to alter the movement speed within the hook to make the movement fluid.
[QUOTE=Acecool;46917447]Well, if the code is executed in one thread, line by line and some code relies on ping then it could slow down all other calls which is why we have FrameTime to alter the movement speed within the hook to make the movement fluid.[/QUOTE]
Movement is damn fluid, The problem is View Angle Difference.
[code]
self.aimAngle = owner:EyeAngles()
self.aimDiff = self.aimAngle - self.oldAimAngle
for i = 1, 3 do
if (360 - math.abs(self.aimDiff[i]) < 180) then
if (self.aimDiff[i] < 0) then
self.aimDiff[i] = self.aimDiff[i] + 360
else
self.aimDiff[i] = self.aimDiff[i] - 360
end
end
end
self.oldAimAngle = self.aimAngle
[/code]
This one.
[editline]16th January 2015[/editline]
Also, The frametime does not matter in this case.
The ping matters...
bump
Well, yeah... FPS wouldn't matter because the game itself isn't governed by fps ( like really old games ) but by time. FrameTime would help with keeping things smooth because it is bound by time.
I'll run some tests on my end in a bit; what is the mimic ping command?
[video=youtube;uPAj0eYiBKk]http://www.youtube.com/watch?v=uPAj0eYiBKk&feature=youtu.be[/video]
[lua]
local owner = self.Owner
local EP, EA, FT, CT, DIFF = EyePos(), EyeAngles(), FrameTime(), CurTime(), LT - CurTime()
LT = CurTime()
local PA = owner:GetViewPunchAngles()
local vel = clamp(owner:GetVelocity():Length2D()/owner:GetWalkSpeed(), 0, 1.5)
local rest = 1 - clamp(owner:GetVelocity():Length2D()/20, 0, 1)
posOutput = Vector(0, 0, 0)
curStep = curStep + (vel/math.pi) * (FT * 10)
local ws = owner:GetWalkSpeed()
self.ironMul = int(.1, self.ironMul, (!self.Owner:OnGround()) and (!self.Owner:OnGround() and 0 or .1) or 1)
bobPos[1] = -sin(curStep/2)*vel
bobPos[2] = sin(curStep/4)*vel*1.5
bobPos[3] = sin(curStep)/1.5*vel
...
[/lua]
:C
This is what I'm talking about.
bump, this also happening on CalcViewModelView.
Have you tried disabling prediction before you do your calculation and re-enabling after?
[url]http://wiki.garrysmod.com/page/Entity/SetLagCompensated[/url]
[QUOTE=Flapadar;46985956]Have you tried disabling prediction before you do your calculation and re-enabling after?
[url]http://wiki.garrysmod.com/page/Entity/SetLagCompensated[/url][/QUOTE]
I don't think lag compenstation is matters with CalcViewModel Movements since it's all clientside and does not have any connection with the server.
Sorry, you need to Log In to post a reply to this thread.