diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2024-10-04 17:20:03 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2024-10-07 18:14:38 +0200 |
commit | 0b7bb1d710e0726f8c4566f7d22f389d3513a6ce (patch) | |
tree | 3c770edacb2c859d11f22a07fcd5dc14e93375d5 /indra | |
parent | e4d47085ad02a9bde8196fea39274c6e964eb0fc (diff) |
#2542 Buoyant Nametags (hide the name tag for deep underwater avatar)
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c8a4e4c205..690cfaa677 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3767,6 +3767,7 @@ LLVector3 LLVOAvatar::idleCalcNameTagPosition(const LLVector3 &root_pos_last) // Avoid of crossing the name tag by the water surface if (mNameText) { + bool hidden = false; F32 water_height = getRegion()->getWaterHeight(); static const F32 WATER_HEIGHT_ABOVE_DELTA = 0.25; if (name_position[VZ] < water_height + WATER_HEIGHT_ABOVE_DELTA) @@ -3780,8 +3781,19 @@ LLVector3 LLVOAvatar::idleCalcNameTagPosition(const LLVector3 &root_pos_last) { name_position[VZ] = water_height + WATER_HEIGHT_ABOVE_DELTA; } + else + { + // Hide the name tag when the camera is above the water + // but the avatar is deep enough under the water surface + hidden = true; + } } } + + if (mNameText->getHidden() != hidden) + { + mNameText->setHidden(hidden); + } } return name_position; |