mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 19:29:54 +02:00
get rid of unneeded updateSimulatorID, set changed simulator id in properties so it gets included in outgoing packet
This commit is contained in:
parent
396f6b1987
commit
a30e807051
3 changed files with 25 additions and 18 deletions
|
@ -1194,10 +1194,3 @@ void EntityItem::updateLifetime(float value) {
|
||||||
_dirtyFlags |= EntityItem::DIRTY_LIFETIME;
|
_dirtyFlags |= EntityItem::DIRTY_LIFETIME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::updateSimulatorID(QString value) {
|
|
||||||
if (_simulatorID != value) {
|
|
||||||
_simulatorID = value;
|
|
||||||
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -294,7 +294,6 @@ public:
|
||||||
void updateCollisionsWillMove(bool value);
|
void updateCollisionsWillMove(bool value);
|
||||||
void updateLifetime(float value);
|
void updateLifetime(float value);
|
||||||
virtual void updateShapeType(ShapeType type) { /* do nothing */ }
|
virtual void updateShapeType(ShapeType type) { /* do nothing */ }
|
||||||
void updateSimulatorID(QString value);
|
|
||||||
|
|
||||||
uint32_t getDirtyFlags() const { return _dirtyFlags; }
|
uint32_t getDirtyFlags() const { return _dirtyFlags; }
|
||||||
void clearDirtyFlags(uint32_t mask = 0xffff) { _dirtyFlags &= ~mask; }
|
void clearDirtyFlags(uint32_t mask = 0xffff) { _dirtyFlags &= ~mask; }
|
||||||
|
|
|
@ -191,13 +191,13 @@ bool EntityMotionState::shouldSendUpdate(uint32_t simulationFrame) {
|
||||||
QString myNodeID = nodeList->getSessionUUID().toString();
|
QString myNodeID = nodeList->getSessionUUID().toString();
|
||||||
QString simulatorID = _entity->getSimulatorID();
|
QString simulatorID = _entity->getSimulatorID();
|
||||||
|
|
||||||
if (simulatorID.isEmpty() && _body->isActive()) {
|
if (simulatorID.isEmpty() && _sentMoving) {
|
||||||
// The object is moving and nobody thinks they own the motion. set this Node as the simulator
|
// The object is moving and nobody thinks they own the motion. set this Node as the simulator
|
||||||
_entity->updateSimulatorID(myNodeID);
|
// _entity->updateSimulatorID(myNodeID);
|
||||||
simulatorID = myNodeID;
|
simulatorID = myNodeID;
|
||||||
} else if (simulatorID == myNodeID && !_body->isActive()) {
|
} else if (simulatorID == myNodeID && !_sentMoving) {
|
||||||
// we are the simulator and the object has stopped. give up "simulator" status
|
// we are the simulator and the object has stopped. give up "simulator" status
|
||||||
_entity->updateSimulatorID("");
|
// _entity->updateSimulatorID("");
|
||||||
simulatorID = "";
|
simulatorID = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,9 +219,9 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
||||||
if (_outgoingPacketFlags) {
|
if (_outgoingPacketFlags) {
|
||||||
EntityItemProperties properties = _entity->getProperties();
|
EntityItemProperties properties = _entity->getProperties();
|
||||||
|
|
||||||
// if (_outgoingPacketFlags & EntityItem::DIRTY_UPDATEABLE) {
|
|
||||||
// properties.setSimulatorID(_entity->getSimulatorID());
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (_outgoingPacketFlags & EntityItem::DIRTY_POSITION) {
|
if (_outgoingPacketFlags & EntityItem::DIRTY_POSITION) {
|
||||||
btTransform worldTrans = _body->getWorldTransform();
|
btTransform worldTrans = _body->getWorldTransform();
|
||||||
|
@ -250,9 +250,6 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
||||||
}
|
}
|
||||||
|
|
||||||
_sentMoving = ! (zeroSpeed && zeroSpin);
|
_sentMoving = ! (zeroSpeed && zeroSpin);
|
||||||
|
|
||||||
qDebug() << "EntityMotionState::sendUpdate" << _sentMoving << _body->isActive();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_sentVelocity = _sentAngularVelocity = glm::vec3(0.0f);
|
_sentVelocity = _sentAngularVelocity = glm::vec3(0.0f);
|
||||||
_sentMoving = false;
|
_sentMoving = false;
|
||||||
|
@ -263,6 +260,24 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
||||||
properties.setAngularVelocity(_sentAngularVelocity);
|
properties.setAngularVelocity(_sentAngularVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qDebug() << "EntityMotionState::sendUpdate" << _sentMoving << _body->isActive();
|
||||||
|
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
QString myNodeID = nodeList->getSessionUUID().toString();
|
||||||
|
QString simulatorID = _entity->getSimulatorID();
|
||||||
|
|
||||||
|
if (simulatorID.isEmpty() && _sentMoving) {
|
||||||
|
// The object is moving and nobody thinks they own the motion. set this Node as the simulator
|
||||||
|
_entity->setSimulatorID(myNodeID);
|
||||||
|
properties.setSimulatorID(myNodeID);
|
||||||
|
} else if (simulatorID == myNodeID && !_sentMoving) {
|
||||||
|
// we are the simulator and the object has stopped. give up "simulator" status
|
||||||
|
_entity->setSimulatorID("");
|
||||||
|
properties.setSimulatorID("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit.
|
// RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit.
|
||||||
if (_sentMoving) {
|
if (_sentMoving) {
|
||||||
_numNonMovingUpdates = 0;
|
_numNonMovingUpdates = 0;
|
||||||
|
|
Loading…
Reference in a new issue