mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-10 12:53:21 +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) {
|
||||
const SortableAvatar& sortData = *it;
|
||||
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
|
||||
if (avatar->getSkeletonModel()->isLoaded()) {
|
||||
// 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;
|
||||
auto oneStepDistance = glm::length(_globalPosition - _serverPosition);
|
||||
if (oneStepDistance <= AVATAR_TRANSIT_MIN_TRIGGER_DISTANCE || oneStepDistance >= AVATAR_TRANSIT_MAX_TRIGGER_DISTANCE) {
|
||||
_globalPosition = _serverPosition;
|
||||
// if we don't have a parent, make sure to also set our local position
|
||||
if (_isClientAvatar) {
|
||||
auto oneStepDistance = glm::length(_globalPosition - _serverPosition);
|
||||
if (oneStepDistance <= AVATAR_TRANSIT_MIN_TRIGGER_DISTANCE || oneStepDistance >= AVATAR_TRANSIT_MAX_TRIGGER_DISTANCE) {
|
||||
_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()) {
|
||||
setLocalPosition(_serverPosition);
|
||||
}
|
||||
}
|
||||
if (_globalPosition != _serverPosition) {
|
||||
_globalPositionChanged = now;
|
||||
}
|
||||
sourceBuffer += sizeof(AvatarDataPacket::AvatarGlobalPosition);
|
||||
int numBytesRead = sourceBuffer - startSection;
|
||||
_globalPositionRate.increment(numBytesRead);
|
||||
|
|
|
@ -1221,6 +1221,7 @@ public:
|
|||
|
||||
void setIsNewAvatar(bool isNewAvatar) { _isNewAvatar = isNewAvatar; }
|
||||
bool getIsNewAvatar() { return _isNewAvatar; }
|
||||
void setIsClientAvatar(bool isClientAvatar) { _isClientAvatar = isClientAvatar; }
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -1486,6 +1487,7 @@ protected:
|
|||
float _density;
|
||||
int _replicaIndex { 0 };
|
||||
bool _isNewAvatar { true };
|
||||
bool _isClientAvatar { false };
|
||||
|
||||
// null unless MyAvatar or ScriptableAvatar sending traits data to mixer
|
||||
std::unique_ptr<ClientTraitsHandler> _clientTraitsHandler;
|
||||
|
|
Loading…
Reference in a new issue