Merge pull request #16208 from AndrewMeadows/ess-with-simulation-fallout-002

BUGZ-1487: bug fix for inability to pick entities after unowned kinematic motion
This commit is contained in:
Sam Gateau 2019-09-18 13:25:22 -07:00 committed by GitHub
commit e801eab7bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -242,11 +242,21 @@ void EntitySimulation::moveSimpleKinematics(uint64_t now) {
entity->getMaximumAACube(ancestryIsKnown);
bool hasAvatarAncestor = entity->hasAncestorOfType(NestableType::Avatar);
if (entity->isMovingRelativeToParent() && !entity->getPhysicsInfo() && ancestryIsKnown && !hasAvatarAncestor) {
bool isMoving = entity->isMovingRelativeToParent();
if (isMoving && !entity->getPhysicsInfo() && ancestryIsKnown && !hasAvatarAncestor) {
entity->simulate(now);
if (ancestryIsKnown && !hasAvatarAncestor) {
entity->updateQueryAACube();
}
_entitiesToSort.insert(entity);
++itemItr;
} else {
if (!isMoving && ancestryIsKnown && !hasAvatarAncestor) {
// HACK: This catches most cases where the entity's QueryAACube (and spatial sorting in the EntityTree)
// would otherwise be out of date at conclusion of its "unowned" simpleKinematicMotion.
entity->updateQueryAACube();
_entitiesToSort.insert(entity);
}
// the entity is no longer non-physical-kinematic
itemItr = _simpleKinematicEntities.erase(itemItr);
}

View file

@ -122,6 +122,12 @@ void EntityMotionState::handleDeactivation() {
_body->setWorldTransform(worldTrans);
// no need to update velocities... should already be zero
}
if (!isLocallyOwned()) {
// HACK: To allow the ESS to move entities around in a kinematic way we had to remove the requirement that
// every moving+simulated entity has an authoritative simulation owner. As a result, we cannot rely
// on a simulation owner to update the QueryAACube on the entity-server.
_entity->updateQueryAACube();
}
}
// virtual

View file

@ -528,6 +528,8 @@ void PhysicalEntitySimulation::handleChangedMotionStates(const VectorOfMotionSta
addOwnership(entityState);
} else if (entityState->shouldSendBid()) {
addOwnershipBid(entityState);
} else {
entityState->getEntity()->updateQueryAACube();
}
}
}