Only do physics and collision calculations on the clients side, and only for their own entity.

This commit is contained in:
Jocke
2016-03-03 11:39:00 +01:00
parent 85ba5552e9
commit cb7beae28c
2 changed files with 87 additions and 90 deletions
+3 -8
View File
@@ -18,14 +18,9 @@ PlayerMovementSystem::~PlayerMovementSystem()
void PlayerMovementSystem::Update(double dt)
{
updateMovementControllers(dt);
if (IsServer) {
for (auto& kv : m_PlayerInputControllers) {
updateVelocity(kv.first, dt);
}
} else {
if (LocalPlayer.Valid()) {
updateVelocity(LocalPlayer, dt);
}
// Only do physics calculations on client and only for themselves.
if (!IsServer && LocalPlayer.Valid()) {
updateVelocity(LocalPlayer, dt);
}
}