diff options
author | Nyx Linden <nyx@lindenlab.com> | 2013-04-03 18:59:50 -0400 |
---|---|---|
committer | Nyx Linden <nyx@lindenlab.com> | 2013-04-03 18:59:50 -0400 |
commit | b724791c2adb3e63c00547c40de2ae1b6ce45b9b (patch) | |
tree | f47380c8d28fe082fbe291e48222b72b16b2cf63 /indra/llappearance/llavatarappearance.cpp | |
parent | af78acc037540ea7953ced111db7fb708e6965a2 (diff) |
SH-4050 FIX camera goes below ground when avatar offset set to 0
Added a constraint to ensure that the avatar's height (with offset)
does not go below 0.1 meters. Camera was getting confused since the avatar's
effective height was negative.
Note the avatar is mostly underground/contorted even at 0.1 meters, but
most users setting values this low will be making ultra-tinies and would
be hiding the avatar mesh. Camera stays above ground when height is at 0.1.
Diffstat (limited to 'indra/llappearance/llavatarappearance.cpp')
-rw-r--r-- | indra/llappearance/llavatarappearance.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 2d5744bb5e..37b7f7b14e 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) + { + 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; |