namechange: TerseUpdate --> TransformAndVelocities

This commit is contained in:
Andrew Meadows 2018-09-26 15:07:29 -07:00
parent 1cc2569bd8
commit f63610af2b
5 changed files with 18 additions and 16 deletions

View file

@ -673,7 +673,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
const QUuid& myNodeID = nodeList->getSessionUUID();
bool weOwnSimulation = _simulationOwner.matchesValidID(myNodeID);
// pack SimulationOwner and terse update properties near each other
// pack SimulationOwner, transform, and velocity properties near each other
// NOTE: the server is authoritative for changes to simOwnerID so we always unpack ownership data
// even when we would otherwise ignore the rest of the packet.
@ -1358,8 +1358,7 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
return properties;
}
void EntityItem::getAllTerseUpdateProperties(EntityItemProperties& properties) const {
// a TerseUpdate includes the transform and its derivatives
void EntityItem::getTransformAndVelocityProperties(EntityItemProperties& properties) const {
if (!properties._positionChanged) {
properties._position = getLocalPosition();
}
@ -1419,7 +1418,7 @@ bool EntityItem::stillWaitingToTakeOwnership(uint64_t timestamp) const {
bool EntityItem::setProperties(const EntityItemProperties& properties) {
bool somethingChanged = false;
// these affect TerseUpdate properties
// these affect transform and velocity properties
SET_ENTITY_PROPERTY_FROM_PROPERTIES(simulationOwner, setSimulationOwner);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(position, setPosition);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(rotation, setRotation);

View file

@ -420,7 +420,7 @@ public:
quint64 getLastEditedFromRemote() const { return _lastEditedFromRemote; }
void updateLastEditedFromRemote() { _lastEditedFromRemote = usecTimestampNow(); }
void getAllTerseUpdateProperties(EntityItemProperties& properties) const;
void getTransformAndVelocityProperties(EntityItemProperties& properties) const;
void flagForMotionStateChange() { _flags |= Simulation::DIRTY_MOTION_TYPE; }

View file

@ -3244,9 +3244,12 @@ AABox EntityItemProperties::getAABox() const {
return AABox(rotatedExtentsRelativeToRegistrationPoint);
}
bool EntityItemProperties::hasTerseUpdateChanges() const {
// a TerseUpdate includes the transform and its derivatives
return _positionChanged || _velocityChanged || _rotationChanged || _angularVelocityChanged || _accelerationChanged;
bool EntityItemProperties::hasTransformOrVelocityChanges() const {
return _positionChanged ||_localPositionChanged
|| _rotationChanged || _localRotationChanged
|| _velocityChanged || _localVelocityChanged
|| _angularVelocityChanged || _localAngularVelocityChanged
|| _accelerationChanged;
}
bool EntityItemProperties::hasMiscPhysicsChanges() const {

View file

@ -349,7 +349,7 @@ public:
void setCreated(QDateTime& v);
bool hasTerseUpdateChanges() const;
bool hasTransformOrVelocityChanges() const;
bool hasMiscPhysicsChanges() const;
void clearSimulationOwner();

View file

@ -597,20 +597,20 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
entityFound = true;
// make sure the properties has a type, so that the encode can know which properties to include
properties.setType(entity->getType());
bool hasTerseUpdateChanges = properties.hasTerseUpdateChanges();
bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTerseUpdateChanges;
bool hasTransformOrVelocityChanges = properties.hasTransformOrVelocityChanges();
bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTransformOrVelocityChanges;
if (_bidOnSimulationOwnership && hasPhysicsChanges) {
auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID();
if (entity->getSimulatorID() == myNodeID) {
// we think we already own the simulation, so make sure to send ALL TerseUpdate properties
if (hasTerseUpdateChanges) {
entity->getAllTerseUpdateProperties(properties);
// we think we already own the simulation, so make sure to send the full transform and all velocities
if (hasTransformOrVelocityChanges) {
entity->getTransformAndVelocityProperties(properties);
}
// TODO: if we knew that ONLY TerseUpdate properties have changed in properties AND the object
// TODO: if we knew that ONLY transforms and velocities have changed in properties AND the object
// is dynamic AND it is active in the physics simulation then we could chose to NOT queue an update
// and instead let the physics simulation decide when to send a terse update. This would remove
// and instead let the physics simulation decide when to send the update. This would remove
// the "slide-no-rotate" glitch (and typical double-update) that we see during the "poke rolling
// balls" test. However, even if we solve this problem we still need to provide a "slerp the visible
// proxy toward the true physical position" feature to hide the final glitches in the remote watcher's