SH-4050 FIX camera goes underground if hover set low enough

Changing viewer limit for avatar height to match server limit, camera does not go underground.
Also clarified where we do not need avatar offset in the code, through comments
master
Nyx Linden 2013-04-25 14:09:42 -04:00
parent b4c60f4303
commit d58b9ee54e
2 changed files with 8 additions and 4 deletions

View File

@ -491,11 +491,13 @@ void LLAvatarAppearance::computeBodySize()
// 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)
if (new_body_size.mV[VZ] + mAvatarOffset.mV[VZ] < 1.1f)
{
mAvatarOffset.mV[VZ] = -(new_body_size.mV[VZ] - 0.11f); // avoid floating point rounding making the above check continue to fail.
F32 old_offset = mAvatarOffset.mV[VZ];
F32 old_effective_height = new_body_size.mV[VZ] + mAvatarOffset.mV[VZ];
mAvatarOffset.mV[VZ] = -(new_body_size.mV[VZ] - 1.11f); // avoid floating point rounding making the above check continue to fail.
llassert(new_body_size.mV[VZ] + mAvatarOffset.mV[VZ] >= 0.1f);
llassert(new_body_size.mV[VZ] + mAvatarOffset.mV[VZ] >= 1.1f);
if (mWearableData && isSelf())
{

View File

@ -2144,7 +2144,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
{
LLVector3 tagPos = mRoot->getWorldPosition();
tagPos[VZ] -= mPelvisToFoot;
tagPos[VZ] += ( mBodySize[VZ] + 0.125f );
tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); // does not need mAvatarOffset -Nyx
mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos );
}
}//if ( voiceEnabled )
@ -2885,6 +2885,8 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
local_camera_up.normalize();
local_camera_up = local_camera_up * inv_root_rot;
// position is based on head position, does not require mAvatarOffset here. - Nyx
LLVector3 avatar_ellipsoid(mBodySize.mV[VX] * 0.4f,
mBodySize.mV[VY] * 0.4f,
mBodySize.mV[VZ] * NAMETAG_VERT_OFFSET_WEIGHT);