mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
add back selective inclusion of Avatars based on distance
This commit is contained in:
parent
746630b378
commit
6f4f55038b
1 changed files with 8 additions and 2 deletions
|
@ -134,8 +134,14 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
AvatarData& otherAvatar = otherNodeData->getAvatar();
|
||||
glm::vec3 otherPosition = otherAvatar.getPosition();
|
||||
|
||||
// Decide whether to send this avatar's data based on current performance throttling
|
||||
if (_performanceThrottlingRatio == 0 || randFloat() < (1.0f - _performanceThrottlingRatio)) {
|
||||
float distanceToAvatar = glm::length(myPosition - otherPosition);
|
||||
// The full rate distance is the distance at which EVERY update will be sent for this avatar
|
||||
// at a distance of twice the full rate distance, there will be a 50% chance of sending this avatar's update
|
||||
const float FULL_RATE_DISTANCE = 2.f;
|
||||
|
||||
// Decide whether to send this avatar's data based on it's distance from us
|
||||
if ((_performanceThrottlingRatio == 0 || randFloat() < (1.0f - _performanceThrottlingRatio))
|
||||
&& (distanceToAvatar == 0.f || randFloat() < FULL_RATE_DISTANCE / distanceToAvatar)) {
|
||||
QByteArray avatarByteArray;
|
||||
avatarByteArray.append(otherNode->getUUID().toRfc4122());
|
||||
avatarByteArray.append(otherAvatar.toByteArray());
|
||||
|
|
Loading…
Reference in a new issue