mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:36:54 +02:00
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:
commit
e801eab7bf
3 changed files with 19 additions and 1 deletions
|
@ -242,11 +242,21 @@ void EntitySimulation::moveSimpleKinematics(uint64_t now) {
|
||||||
entity->getMaximumAACube(ancestryIsKnown);
|
entity->getMaximumAACube(ancestryIsKnown);
|
||||||
bool hasAvatarAncestor = entity->hasAncestorOfType(NestableType::Avatar);
|
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);
|
entity->simulate(now);
|
||||||
|
if (ancestryIsKnown && !hasAvatarAncestor) {
|
||||||
|
entity->updateQueryAACube();
|
||||||
|
}
|
||||||
_entitiesToSort.insert(entity);
|
_entitiesToSort.insert(entity);
|
||||||
++itemItr;
|
++itemItr;
|
||||||
} else {
|
} 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
|
// the entity is no longer non-physical-kinematic
|
||||||
itemItr = _simpleKinematicEntities.erase(itemItr);
|
itemItr = _simpleKinematicEntities.erase(itemItr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,12 @@ void EntityMotionState::handleDeactivation() {
|
||||||
_body->setWorldTransform(worldTrans);
|
_body->setWorldTransform(worldTrans);
|
||||||
// no need to update velocities... should already be zero
|
// 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
|
// virtual
|
||||||
|
|
|
@ -528,6 +528,8 @@ void PhysicalEntitySimulation::handleChangedMotionStates(const VectorOfMotionSta
|
||||||
addOwnership(entityState);
|
addOwnership(entityState);
|
||||||
} else if (entityState->shouldSendBid()) {
|
} else if (entityState->shouldSendBid()) {
|
||||||
addOwnershipBid(entityState);
|
addOwnershipBid(entityState);
|
||||||
|
} else {
|
||||||
|
entityState->getEntity()->updateQueryAACube();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue