MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ApplyRemoteState

Method ApplyRemoteState

engine/Poseidon/World/Simulation/Simul.cpp:91–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void Entity::ApplyRemoteState(float deltaT)
92{
93 // Local units are authoritative; nothing to correct. Single-player keeps
94 // every unit local, so this whole path is inert outside MP clients.
95 if (IsLocal() || !_remoteInterp.HasTarget())
96 {
97 return;
98 }
99 // Once prediction is frozen the unit must hold still until the next update,
100 // not keep chasing an extrapolated ghost.
101 if (CheckPredictionFrozen())
102 {
103 _remoteInterp.Clear();
104 return;
105 }
106
107 RemoteInterpParams params;
108 RemoteInterpResult res = _remoteInterp.Step(deltaT, Position(), _speed, Orientation(), params);
109 if (!res.active)
110 {
111 return;
112 }
113
114 Matrix4 trans;
115 trans.SetOrientation(res.orientation);
116 trans.SetPosition(res.position);
117 Move(trans);
118 SetSpeed(res.speed);
119}
120
121static Vector3 AddFriction(Vector3Val accel, Vector3Val friction)
122{

Callers

nothing calls this directly

Calls 5

HasTargetMethod · 0.80
ClearMethod · 0.45
StepMethod · 0.45
SetOrientationMethod · 0.45
SetPositionMethod · 0.45

Tested by

no test coverage detected