From 6f83f32eccbc2726e9153c3bd3ea8f2e2d19b2ab Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 12 Nov 2015 16:27:54 -0800 Subject: [PATCH] adjust how the decision to send action changes over the wire is made --- libraries/physics/src/EntityMotionState.cpp | 43 ++++++++------------- libraries/physics/src/EntityMotionState.h | 1 - 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 03e1c1c5b7..66f5d46c18 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -87,15 +87,11 @@ void EntityMotionState::updateServerPhysicsVariables(const QUuid& sessionID) { } _serverActionData = _entity->getActionData(); - if (!_serverShouldSuppressLocationEdits) { - _serverPosition = _entity->getPosition(); - _serverRotation = _entity->getRotation(); - _serverVelocity = _entity->getVelocity(); - _serverAngularVelocity = _entity->getAngularVelocity(); - _serverAcceleration = _entity->getAcceleration(); - } - - _serverShouldSuppressLocationEdits = _entity->shouldSuppressLocationEdits(); + _serverPosition = _entity->getPosition(); + _serverRotation = _entity->getRotation(); + _serverVelocity = _entity->getVelocity(); + _serverAngularVelocity = _entity->getAngularVelocity(); + _serverAcceleration = _entity->getAcceleration(); } // virtual @@ -262,7 +258,6 @@ bool EntityMotionState::remoteSimulationOutOfSync(uint32_t simulationStep) { _serverAngularVelocity = bulletToGLM(_body->getAngularVelocity()); _lastStep = simulationStep; _serverActionData = _entity->getActionData(); - _serverShouldSuppressLocationEdits = _entity->shouldSuppressLocationEdits(); _sentInactive = true; return false; } @@ -448,24 +443,20 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, const Q EntityItemProperties properties; + // remember properties for local server prediction + _serverPosition = _entity->getPosition(); + _serverRotation = _entity->getRotation(); + _serverVelocity = _entity->getVelocity(); + _serverAcceleration = _entity->getAcceleration(); + _serverAngularVelocity = _entity->getAngularVelocity(); + _serverActionData = _entity->getActionData(); // explicitly set the properties that changed so that they will be packed - if (!_serverShouldSuppressLocationEdits) { - // remember properties for local server prediction - _serverPosition = _entity->getPosition(); - _serverRotation = _entity->getRotation(); - _serverVelocity = _entity->getVelocity(); - _serverAcceleration = _entity->getAcceleration(); - _serverAngularVelocity = _entity->getAngularVelocity(); - - properties.setPosition(_serverPosition); - properties.setRotation(_serverRotation); - properties.setVelocity(_serverVelocity); - properties.setAcceleration(_serverAcceleration); - properties.setAngularVelocity(_serverAngularVelocity); - } - _serverShouldSuppressLocationEdits = _entity->shouldSuppressLocationEdits(); - _serverActionData = _entity->getActionData(); + properties.setPosition(_serverPosition); + properties.setRotation(_serverRotation); + properties.setVelocity(_serverVelocity); + properties.setAcceleration(_serverAcceleration); + properties.setAngularVelocity(_serverAngularVelocity); properties.setActionData(_serverActionData); // set the LastEdited of the properties but NOT the entity itself diff --git a/libraries/physics/src/EntityMotionState.h b/libraries/physics/src/EntityMotionState.h index f70eff44a4..188e7096b9 100644 --- a/libraries/physics/src/EntityMotionState.h +++ b/libraries/physics/src/EntityMotionState.h @@ -110,7 +110,6 @@ protected: glm::vec3 _serverGravity; glm::vec3 _serverAcceleration; QByteArray _serverActionData; - bool _serverShouldSuppressLocationEdits = false; uint32_t _lastMeasureStep; glm::vec3 _lastVelocity;