From 23892ab1e70a4e9abe7f07c164370fe2d90d2944 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 27 Jan 2015 11:38:14 -0800 Subject: [PATCH] fixed comments --- libraries/entities/src/EntityItem.cpp | 12 +++++------- libraries/physics/src/EntityMotionState.cpp | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 86e116bf9f..64cbf8ab04 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -542,13 +542,11 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef recalculateCollisionShape(); if (overwriteLocalData && (getDirtyFlags() & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY))) { - // TODO: Andrew & Brad to discuss -- this probably should not be "now" but instead should be the last - // simulated time from server. The logic should maybe be: the position changed from the server, so the - // position we just set can be thought of as the position at the time it was last simulated by the - // server (clock skew adjusted). By setting it to "now" we are saying that the last position is to be - // considered to be the correct position for "now" which is likely in the future from when it actually - // was at that last known positition. - + // NOTE: This code is attempting to "repair" the old data we just got from the server to make it more + // closely match where the entities should be if they'd stepped forward in time to "now". The server + // is sending us data with a known "last simulated" time. That time is likely in the past, and therefore + // this "new" data is actually slightly out of date. We calculate the time we need to skip forward and + // use our simulation helper routine to get a best estimate of where the entity should be. float skipTimeForward = (float)(now - _lastSimulated) / (float)(USECS_PER_SECOND); if (skipTimeForward > 0.0f) { #ifdef WANT_DEBUG diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 6283229dea..acff3ed64a 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -228,7 +228,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ // we only update lastEdited when we're sending new physics data // (i.e. NOT when we just simulate the positions forward, nore when we resend non-moving data) // NOTE: Andrew & Brad to discuss. Let's make sure we're using lastEdited, lastSimulated, and lastUpdated correctly - quint64 lastSimulated = _entity->getLastSimulated(); // or now??? + quint64 lastSimulated = _entity->getLastSimulated(); _entity->setLastEdited(lastSimulated); properties.setLastEdited(lastSimulated);