mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 20:56:52 +02:00
Merge pull request #14288 from luiscuenca/avatarTransitFreezeFix
Fix avatars remain stuck in place for other users intermittently
This commit is contained in:
commit
db87fe9696
3 changed files with 22 additions and 8 deletions
|
@ -261,7 +261,9 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
||||||
for (auto it = sortedAvatarVector.begin(); it != sortedAvatarVector.end(); ++it) {
|
for (auto it = sortedAvatarVector.begin(); it != sortedAvatarVector.end(); ++it) {
|
||||||
const SortableAvatar& sortData = *it;
|
const SortableAvatar& sortData = *it;
|
||||||
const auto avatar = std::static_pointer_cast<OtherAvatar>(sortData.getAvatar());
|
const auto avatar = std::static_pointer_cast<OtherAvatar>(sortData.getAvatar());
|
||||||
|
if (!avatar->_isClientAvatar) {
|
||||||
|
avatar->setIsClientAvatar(true);
|
||||||
|
}
|
||||||
// TODO: to help us scale to more avatars it would be nice to not have to poll this stuff every update
|
// TODO: to help us scale to more avatars it would be nice to not have to poll this stuff every update
|
||||||
if (avatar->getSkeletonModel()->isLoaded()) {
|
if (avatar->getSkeletonModel()->isLoaded()) {
|
||||||
// remove the orb if it is there
|
// remove the orb if it is there
|
||||||
|
|
|
@ -936,17 +936,27 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_serverPosition = glm::vec3(data->globalPosition[0], data->globalPosition[1], data->globalPosition[2]) + offset;
|
_serverPosition = glm::vec3(data->globalPosition[0], data->globalPosition[1], data->globalPosition[2]) + offset;
|
||||||
auto oneStepDistance = glm::length(_globalPosition - _serverPosition);
|
if (_isClientAvatar) {
|
||||||
if (oneStepDistance <= AVATAR_TRANSIT_MIN_TRIGGER_DISTANCE || oneStepDistance >= AVATAR_TRANSIT_MAX_TRIGGER_DISTANCE) {
|
auto oneStepDistance = glm::length(_globalPosition - _serverPosition);
|
||||||
_globalPosition = _serverPosition;
|
if (oneStepDistance <= AVATAR_TRANSIT_MIN_TRIGGER_DISTANCE || oneStepDistance >= AVATAR_TRANSIT_MAX_TRIGGER_DISTANCE) {
|
||||||
// if we don't have a parent, make sure to also set our local position
|
_globalPosition = _serverPosition;
|
||||||
|
// if we don't have a parent, make sure to also set our local position
|
||||||
|
if (!hasParent()) {
|
||||||
|
setLocalPosition(_serverPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_globalPosition != _serverPosition) {
|
||||||
|
_globalPositionChanged = now;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_globalPosition != _serverPosition) {
|
||||||
|
_globalPosition = _serverPosition;
|
||||||
|
_globalPositionChanged = now;
|
||||||
|
}
|
||||||
if (!hasParent()) {
|
if (!hasParent()) {
|
||||||
setLocalPosition(_serverPosition);
|
setLocalPosition(_serverPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_globalPosition != _serverPosition) {
|
|
||||||
_globalPositionChanged = now;
|
|
||||||
}
|
|
||||||
sourceBuffer += sizeof(AvatarDataPacket::AvatarGlobalPosition);
|
sourceBuffer += sizeof(AvatarDataPacket::AvatarGlobalPosition);
|
||||||
int numBytesRead = sourceBuffer - startSection;
|
int numBytesRead = sourceBuffer - startSection;
|
||||||
_globalPositionRate.increment(numBytesRead);
|
_globalPositionRate.increment(numBytesRead);
|
||||||
|
|
|
@ -1221,6 +1221,7 @@ public:
|
||||||
|
|
||||||
void setIsNewAvatar(bool isNewAvatar) { _isNewAvatar = isNewAvatar; }
|
void setIsNewAvatar(bool isNewAvatar) { _isNewAvatar = isNewAvatar; }
|
||||||
bool getIsNewAvatar() { return _isNewAvatar; }
|
bool getIsNewAvatar() { return _isNewAvatar; }
|
||||||
|
void setIsClientAvatar(bool isClientAvatar) { _isClientAvatar = isClientAvatar; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -1486,6 +1487,7 @@ protected:
|
||||||
float _density;
|
float _density;
|
||||||
int _replicaIndex { 0 };
|
int _replicaIndex { 0 };
|
||||||
bool _isNewAvatar { true };
|
bool _isNewAvatar { true };
|
||||||
|
bool _isClientAvatar { false };
|
||||||
|
|
||||||
// null unless MyAvatar or ScriptableAvatar sending traits data to mixer
|
// null unless MyAvatar or ScriptableAvatar sending traits data to mixer
|
||||||
std::unique_ptr<ClientTraitsHandler> _clientTraitsHandler;
|
std::unique_ptr<ClientTraitsHandler> _clientTraitsHandler;
|
||||||
|
|
Loading…
Reference in a new issue