mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:41:02 +02:00
Better estimate of avatar centre for zone membership
This commit is contained in:
parent
d7a1ecdbb3
commit
46f897b693
3 changed files with 6 additions and 7 deletions
|
@ -23,9 +23,6 @@
|
||||||
|
|
||||||
#include "AvatarMixerSlave.h"
|
#include "AvatarMixerSlave.h"
|
||||||
|
|
||||||
// Offset from reported position for priority-zone purposes:
|
|
||||||
const glm::vec3 AvatarMixerClientData::AVATAR_CENTER_OFFSET { 0.0f, 1.0f, 0.0 };
|
|
||||||
|
|
||||||
AvatarMixerClientData::AvatarMixerClientData(const QUuid& nodeID, Node::LocalID nodeLocalID) :
|
AvatarMixerClientData::AvatarMixerClientData(const QUuid& nodeID, Node::LocalID nodeLocalID) :
|
||||||
NodeData(nodeID, nodeLocalID) {
|
NodeData(nodeID, nodeLocalID) {
|
||||||
// in case somebody calls getSessionUUID on the AvatarData instance, make sure it has the right ID
|
// in case somebody calls getSessionUUID on the AvatarData instance, make sure it has the right ID
|
||||||
|
@ -132,7 +129,7 @@ int AvatarMixerClientData::parseData(ReceivedMessage& message, const SlaveShared
|
||||||
incrementNumOutOfOrderSends();
|
incrementNumOutOfOrderSends();
|
||||||
}
|
}
|
||||||
_lastReceivedSequenceNumber = sequenceNumber;
|
_lastReceivedSequenceNumber = sequenceNumber;
|
||||||
glm::vec3 oldPosition = getPosition();
|
glm::vec3 oldPosition = _avatar->getCentroidPosition();
|
||||||
bool oldHasPriority = _avatar->getHasPriority();
|
bool oldHasPriority = _avatar->getHasPriority();
|
||||||
|
|
||||||
// compute the offset to the data payload
|
// compute the offset to the data payload
|
||||||
|
@ -143,10 +140,10 @@ int AvatarMixerClientData::parseData(ReceivedMessage& message, const SlaveShared
|
||||||
// Regardless of what the client says, restore the priority as we know it without triggering any update.
|
// Regardless of what the client says, restore the priority as we know it without triggering any update.
|
||||||
_avatar->setHasPriorityWithoutTimestampReset(oldHasPriority);
|
_avatar->setHasPriorityWithoutTimestampReset(oldHasPriority);
|
||||||
|
|
||||||
auto newPosition = getPosition();
|
auto newPosition = _avatar->getCentroidPosition();
|
||||||
if (newPosition != oldPosition || _avatar->getNeedsHeroCheck()) {
|
if (newPosition != oldPosition || _avatar->getNeedsHeroCheck()) {
|
||||||
EntityTree& entityTree = *slaveSharedData.entityTree;
|
EntityTree& entityTree = *slaveSharedData.entityTree;
|
||||||
FindPriorityZone findPriorityZone { newPosition + AVATAR_CENTER_OFFSET } ;
|
FindPriorityZone findPriorityZone { newPosition } ;
|
||||||
entityTree.recurseTreeWithOperation(&FindPriorityZone::operation, &findPriorityZone);
|
entityTree.recurseTreeWithOperation(&FindPriorityZone::operation, &findPriorityZone);
|
||||||
_avatar->setHasPriority(findPriorityZone.isInPriorityZone);
|
_avatar->setHasPriority(findPriorityZone.isInPriorityZone);
|
||||||
_avatar->setNeedsHeroCheck(false);
|
_avatar->setNeedsHeroCheck(false);
|
||||||
|
|
|
@ -223,7 +223,6 @@ private:
|
||||||
PerNodeTraitVersions _perNodeSentTraitVersions;
|
PerNodeTraitVersions _perNodeSentTraitVersions;
|
||||||
|
|
||||||
std::atomic_bool _isIgnoreRadiusEnabled { false };
|
std::atomic_bool _isIgnoreRadiusEnabled { false };
|
||||||
static const glm::vec3 AVATAR_CENTER_OFFSET;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AvatarMixerClientData_h
|
#endif // hifi_AvatarMixerClientData_h
|
||||||
|
|
|
@ -22,6 +22,9 @@ public:
|
||||||
bool getNeedsHeroCheck() const { return _needsHeroCheck; }
|
bool getNeedsHeroCheck() const { return _needsHeroCheck; }
|
||||||
void setNeedsHeroCheck(bool needsHeroCheck = true)
|
void setNeedsHeroCheck(bool needsHeroCheck = true)
|
||||||
{ _needsHeroCheck = needsHeroCheck; }
|
{ _needsHeroCheck = needsHeroCheck; }
|
||||||
|
// Bounding-box World centre:
|
||||||
|
glm::vec3 getCentroidPosition() const
|
||||||
|
{ return getWorldPosition() + _globalBoundingBoxOffset; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _needsHeroCheck { false };
|
bool _needsHeroCheck { false };
|
||||||
|
|
Loading…
Reference in a new issue