adjust how the decision to send action changes over the wire is made

This commit is contained in:
Seth Alves 2015-11-12 16:27:54 -08:00
parent d7be1699a7
commit 6f83f32ecc
2 changed files with 17 additions and 27 deletions

View file

@ -87,15 +87,11 @@ void EntityMotionState::updateServerPhysicsVariables(const QUuid& sessionID) {
} }
_serverActionData = _entity->getActionData(); _serverActionData = _entity->getActionData();
if (!_serverShouldSuppressLocationEdits) { _serverPosition = _entity->getPosition();
_serverPosition = _entity->getPosition(); _serverRotation = _entity->getRotation();
_serverRotation = _entity->getRotation(); _serverVelocity = _entity->getVelocity();
_serverVelocity = _entity->getVelocity(); _serverAngularVelocity = _entity->getAngularVelocity();
_serverAngularVelocity = _entity->getAngularVelocity(); _serverAcceleration = _entity->getAcceleration();
_serverAcceleration = _entity->getAcceleration();
}
_serverShouldSuppressLocationEdits = _entity->shouldSuppressLocationEdits();
} }
// virtual // virtual
@ -262,7 +258,6 @@ bool EntityMotionState::remoteSimulationOutOfSync(uint32_t simulationStep) {
_serverAngularVelocity = bulletToGLM(_body->getAngularVelocity()); _serverAngularVelocity = bulletToGLM(_body->getAngularVelocity());
_lastStep = simulationStep; _lastStep = simulationStep;
_serverActionData = _entity->getActionData(); _serverActionData = _entity->getActionData();
_serverShouldSuppressLocationEdits = _entity->shouldSuppressLocationEdits();
_sentInactive = true; _sentInactive = true;
return false; return false;
} }
@ -448,24 +443,20 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, const Q
EntityItemProperties properties; 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 // explicitly set the properties that changed so that they will be packed
if (!_serverShouldSuppressLocationEdits) { properties.setPosition(_serverPosition);
// remember properties for local server prediction properties.setRotation(_serverRotation);
_serverPosition = _entity->getPosition(); properties.setVelocity(_serverVelocity);
_serverRotation = _entity->getRotation(); properties.setAcceleration(_serverAcceleration);
_serverVelocity = _entity->getVelocity(); properties.setAngularVelocity(_serverAngularVelocity);
_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.setActionData(_serverActionData); properties.setActionData(_serverActionData);
// set the LastEdited of the properties but NOT the entity itself // set the LastEdited of the properties but NOT the entity itself

View file

@ -110,7 +110,6 @@ protected:
glm::vec3 _serverGravity; glm::vec3 _serverGravity;
glm::vec3 _serverAcceleration; glm::vec3 _serverAcceleration;
QByteArray _serverActionData; QByteArray _serverActionData;
bool _serverShouldSuppressLocationEdits = false;
uint32_t _lastMeasureStep; uint32_t _lastMeasureStep;
glm::vec3 _lastVelocity; glm::vec3 _lastVelocity;