summaryrefslogtreecommitdiff
path: root/indra/llappearance/llavatarappearance.cpp
diff options
context:
space:
mode:
authorprep <prep@lindenlab.com>2013-04-08 17:11:24 -0400
committerprep <prep@lindenlab.com>2013-04-08 17:11:24 -0400
commita2a25c9ed5de12cfb8a08844682368dc236a1b42 (patch)
treeab3f3eb48cac5fedb091a9fe46cc0eefd64315ce /indra/llappearance/llavatarappearance.cpp
parent985b7277e824c39275d9a06c6262b6f394b02133 (diff)
parentb4c60f430332674e5dbdb672152e62d252e9a6e1 (diff)
merge
Diffstat (limited to 'indra/llappearance/llavatarappearance.cpp')
-rw-r--r--indra/llappearance/llavatarappearance.cpp21
1 files changed, 20 insertions, 1 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;