Peter McKeown
2015-05-31 01:21:28 UTC
Greetings everyone,
There is a bug with the codebase where in
some situations the first person spectating of other players can become
very laggy, as interpolation for m_angEyeAngles stops.
This bug
is present in TF2's code as well as I've seen it there too. The
issue is that the player's ShouldInterpolate() doesn't take into
account if the local player is spectating this player or not, causing it
to no longer have it's interpolated variables (like m_iv_angEyeAngles)
processed. I've been hunting this bug for a while in my mod and finally
solved it, and I figured I'd share the solution here:
In c_baseplayer.cpp, go to the ShouldInterpolate() function, and add this at the bottom above BaseClass::ShouldInterpolate():
if ( GetLocalPlayer() && GetLocalPlayer()->GetObserverTarget() == this )
return true;
This will fix it. Hope this helps!
Note: I didn't look too much into this, but the spectating of players is done via CalcView which doesn't appear to change what render->GetViewEntity() would return - the entity returned by this always interpolated, which would seem to be the intended way for this to work, but doesn't.
Regards,
Peter
There is a bug with the codebase where in
some situations the first person spectating of other players can become
very laggy, as interpolation for m_angEyeAngles stops.
This bug
is present in TF2's code as well as I've seen it there too. The
issue is that the player's ShouldInterpolate() doesn't take into
account if the local player is spectating this player or not, causing it
to no longer have it's interpolated variables (like m_iv_angEyeAngles)
processed. I've been hunting this bug for a while in my mod and finally
solved it, and I figured I'd share the solution here:
In c_baseplayer.cpp, go to the ShouldInterpolate() function, and add this at the bottom above BaseClass::ShouldInterpolate():
if ( GetLocalPlayer() && GetLocalPlayer()->GetObserverTarget() == this )
return true;
This will fix it. Hope this helps!
Note: I didn't look too much into this, but the spectating of players is done via CalcView which doesn't appear to change what render->GetViewEntity() would return - the entity returned by this always interpolated, which would seem to be the intended way for this to work, but doesn't.
Regards,
Peter