summaryrefslogtreecommitdiff
path: root/indra/llappearance
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llappearance')
-rw-r--r--indra/llappearance/llavatarappearance.cpp21
-rw-r--r--indra/llappearance/llavatarappearancedefines.h2
-rw-r--r--indra/llappearance/llwearabledata.h2
3 files changed, 23 insertions, 2 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 2d5744bb5e..3bb759d458 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -464,7 +464,7 @@ void LLAvatarAppearance::computeBodySize()
F32 old_offset = mAvatarOffset.mV[VZ];
- mAvatarOffset.mV[VZ] = getVisualParamWeight(11001);
+ mAvatarOffset.mV[VZ] = getVisualParamWeight(AVATAR_HOVER);
mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
knee.mV[VZ] * hip_scale.mV[VZ] -
@@ -488,6 +488,25 @@ void LLAvatarAppearance::computeBodySize()
mAvatarOffset.mV[VX] = 0.0f;
mAvatarOffset.mV[VY] = 0.0f;
+ // Certain configurations of avatars can force the overall height (with offset) to go negative.
+ // Enforce a constraint to make sure we don't go below 0.1 meters.
+ // Camera positioning and other things start to break down when your avatar is "walking" while being fully underground
+ if (new_body_size.mV[VZ] + mAvatarOffset.mV[VZ] < 0.1f)
+ {
+ mAvatarOffset.mV[VZ] = -(new_body_size.mV[VZ] - 0.11f); // avoid floating point rounding making the above check continue to fail.
+
+ llassert(new_body_size.mV[VZ] + mAvatarOffset.mV[VZ] >= 0.1f);
+
+ if (mWearableData && isSelf())
+ {
+ LLWearable* shape = mWearableData->getWearable(LLWearableType::WT_SHAPE, 0);
+ if (shape)
+ {
+ shape->setVisualParamWeight(AVATAR_HOVER, mAvatarOffset.mV[VZ], false);
+ }
+ }
+ }
+
if (new_body_size != mBodySize || old_offset != mAvatarOffset.mV[VZ])
{
mBodySize = new_body_size;
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h
index 496f85c107..8a1d2c4707 100644
--- a/indra/llappearance/llavatarappearancedefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -41,6 +41,8 @@ extern const S32 SCRATCH_TEX_WIDTH;
extern const S32 SCRATCH_TEX_HEIGHT;
extern const S32 IMPOSTOR_PERIOD;
+static const U32 AVATAR_HOVER = 11001;
+
//--------------------------------------------------------------------
// Enums
//--------------------------------------------------------------------
diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h
index 3e92f2ead8..03bd179f25 100644
--- a/indra/llappearance/llwearabledata.h
+++ b/indra/llappearance/llwearabledata.h
@@ -2,7 +2,7 @@
* @file llwearabledata.h
* @brief LLWearableData class header file
*
- * $LicenseInfo:firstyear=20012license=viewerlgpl$
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*