Only do physics and collision calculations on the clients side, and only for their own entity.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user