SH-3909 Support avatar height offset
Adding a new visual param that allows users to manually adjust an offset for how far off the ground (+ or -) their avatar's root bone is. Supports the +-2m range people are used to adjusting in their viewers, but new implementation should support server-generated appearances. Conflicts: indra/newview/character/avatar_lad.xml indra/newview/llagent.cpp indra/newview/llcallingcard.cpp indra/newview/skins/default/xui/en/strings.xml
This commit is contained in:
committed by
Latif Khalifa
parent
ad03c27805
commit
07850410b5
@@ -465,6 +465,10 @@ void LLAvatarAppearance::computeBodySize()
|
||||
|
||||
LLVector3 foot = mFootLeftp->getPosition();
|
||||
|
||||
F32 old_offset = mAvatarOffset.mV[VZ];
|
||||
|
||||
mAvatarOffset.mV[VZ] = getVisualParamWeight(11001);
|
||||
|
||||
mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
|
||||
knee.mV[VZ] * hip_scale.mV[VZ] -
|
||||
ankle.mV[VZ] * knee_scale.mV[VZ] -
|
||||
@@ -484,7 +488,10 @@ void LLAvatarAppearance::computeBodySize()
|
||||
new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH;
|
||||
new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH;
|
||||
|
||||
if (new_body_size != mBodySize)
|
||||
mAvatarOffset.mV[VX] = 0.0f;
|
||||
mAvatarOffset.mV[VY] = 0.0f;
|
||||
|
||||
if (new_body_size != mBodySize || old_offset != mAvatarOffset.mV[VZ])
|
||||
{
|
||||
mBodySize = new_body_size;
|
||||
bodySizeChanged();
|
||||
|
||||
@@ -165,6 +165,7 @@ protected:
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLVector3 mBodySize;
|
||||
LLVector3 mAvatarOffset;
|
||||
protected:
|
||||
F32 mPelvisToFoot;
|
||||
|
||||
|
||||
@@ -823,6 +823,23 @@
|
||||
<bone name="mNeck" scale="0 0 .5" />
|
||||
</param_skeleton>
|
||||
</param>
|
||||
|
||||
<param
|
||||
id="11001"
|
||||
group="0"
|
||||
name="Hover"
|
||||
wearable="shape"
|
||||
edit_group="shape_body"
|
||||
edit_group_order="4"
|
||||
label_min="Lower"
|
||||
label_max="Higher"
|
||||
value_min="-2"
|
||||
value_max="2"
|
||||
value_default="0"
|
||||
camera_distance="2.5">
|
||||
<param_skeleton />
|
||||
</param>
|
||||
|
||||
</skeleton>
|
||||
|
||||
<mesh
|
||||
|
||||
@@ -2310,7 +2310,7 @@ void LLAgent::setStartPosition( U32 location_id )
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// the z height is at the agent's feet
|
||||
agent_pos.mV[VZ] -= 0.5f * gAgentAvatarp->mBodySize.mV[VZ];
|
||||
agent_pos.mV[VZ] -= 0.5f * (gAgentAvatarp->mBodySize.mV[VZ] + gAgentAvatarp->mAvatarOffset.mV[VZ]);
|
||||
}
|
||||
|
||||
agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET );
|
||||
@@ -4527,7 +4527,7 @@ void LLAgent::sendAgentSetAppearance()
|
||||
// NOTE -- when we start correcting all of the other Havok geometry
|
||||
// to compensate for the COLLISION_TOLERANCE ugliness we will have
|
||||
// to tweak this number again
|
||||
LLVector3 body_size = gAgentAvatarp->mBodySize;
|
||||
LLVector3 body_size = gAgentAvatarp->mBodySize + gAgentAvatarp->mAvatarOffset;
|
||||
|
||||
static LLCachedControl<F32> x_off("AscentAvatarXModifier");
|
||||
static LLCachedControl<F32> y_off("AscentAvatarYModifier");
|
||||
|
||||
@@ -190,7 +190,7 @@ LLVector3d LLAvatarTracker::getGlobalPos()
|
||||
global_pos = avatarp->getPositionGlobal();
|
||||
// HACK - for making the tracker point above the avatar's head
|
||||
// rather than its groin
|
||||
global_pos.mdV[VZ] += 0.7f * avatarp->mBodySize.mV[VZ];
|
||||
global_pos.mdV[VZ] += 0.7f * (avatarp->mBodySize.mV[VZ] + avatarp->mAvatarOffset.mV[VZ]);
|
||||
|
||||
mTrackingData->mGlobalPositionEstimate = global_pos;
|
||||
}
|
||||
|
||||
@@ -2489,7 +2489,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
|
||||
{
|
||||
LLVector3 tagPos = mRoot->getWorldPosition();
|
||||
tagPos[VZ] -= mPelvisToFoot;
|
||||
tagPos[VZ] += ( mBodySize[VZ] + 0.125f );
|
||||
tagPos[VZ] += ( mBodySize[VZ] + mAvatarOffset[VZ] + 0.125f );
|
||||
mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos );
|
||||
}
|
||||
}//if ( voiceEnabled )
|
||||
@@ -3489,12 +3489,12 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
|
||||
local_camera_up.normalize();
|
||||
local_camera_up = local_camera_up * ~root_rot;
|
||||
|
||||
local_camera_up.scaleVec(mBodySize * 0.5f);
|
||||
local_camera_at.scaleVec(mBodySize * 0.5f);
|
||||
local_camera_up.scaleVec((mBodySize + mAvatarOffset) * 0.5f);
|
||||
local_camera_at.scaleVec((mBodySize + mAvatarOffset) * 0.5f);
|
||||
|
||||
LLVector3 name_position = mRoot->getWorldPosition();
|
||||
name_position[VZ] -= mPelvisToFoot;
|
||||
name_position[VZ] += (mBodySize[VZ]* 0.55f);
|
||||
name_position[VZ] += ((mBodySize[VZ] + mAvatarOffset[VZ])* 0.55f);
|
||||
name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av));
|
||||
name_position += pixel_up_vec * 15.f;
|
||||
|
||||
@@ -3826,6 +3826,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
|
||||
}
|
||||
|
||||
root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition());
|
||||
root_pos.mdV[VZ] += getVisualParamWeight(11001);
|
||||
|
||||
|
||||
resolveHeightGlobal(root_pos, ground_under_pelvis, normal);
|
||||
F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]);
|
||||
|
||||
@@ -3617,6 +3617,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
|
||||
<string name="Higher">Higher</string>
|
||||
<string name="Hip Length">Hip Length</string>
|
||||
<string name="Hip Width">Hip Width</string>
|
||||
<string name="Hover">Hover</string>
|
||||
<string name="In">In</string>
|
||||
<string name="In Shdw Color">Inner Shadow Color</string>
|
||||
<string name="In Shdw Opacity">Inner Shadow Opacity</string>
|
||||
|
||||
Reference in New Issue
Block a user