SL-402 - update mBodySize more frequently to avoid inconsistent vertical positioning of avatar.

meow-7.2.2
Brad Payne (Vir Linden) 2016-07-05 14:42:47 -04:00
parent 99250b4e0c
commit 3bc8a97440
1 changed files with 12 additions and 18 deletions

View File

@ -3596,6 +3596,12 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
}
mInAir = in_air;
// SL-402: with the ability to animate the position of joints
// that affect the body size calculation, computed body size
// can get stale much more easily. Simplest fix is to update
// it frequently.
computeBodySize();
// correct for the fact that the pelvis is not necessarily the center
// of the agent's physical representation
root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot;
@ -3995,16 +4001,7 @@ void LLVOAvatar::debugBodySize() const
void LLVOAvatar::postPelvisSetRecalc()
{
mRoot->updateWorldMatrixChildren();
// BENTO extra tracing around computeBodySize()
LLVector3 body_size = mBodySize;
LLVector3 avatar_offset = mAvatarOffset;
computeBodySize();
if (mBodySize != body_size || mAvatarOffset != avatar_offset)
{
debugBodySize();
LL_DEBUGS("Avatar") << avString() << "old mBodySize " << body_size << " old mAvatarOffset " << avatar_offset << LL_ENDL;
LL_DEBUGS("Avatar") << avString() << "new mBodySize " << mBodySize << " new mAvatarOffset " << mAvatarOffset << LL_ENDL;
}
dirtyMesh(2);
}
//------------------------------------------------------------------------
@ -5947,16 +5944,7 @@ void LLVOAvatar::updateVisualParams()
if (mLastSkeletonSerialNum != mSkeletonSerialNum)
{
// BENTO extra tracing around computeBodySize()
LLVector3 body_size = mBodySize;
LLVector3 avatar_offset = mAvatarOffset;
computeBodySize();
if (mBodySize != body_size || mAvatarOffset != avatar_offset)
{
debugBodySize();
LL_DEBUGS("Avatar") << avString() << "old mBodySize " << body_size << " old mAvatarOffset " << avatar_offset << LL_ENDL;
LL_DEBUGS("Avatar") << avString() << "new mBodySize " << mBodySize << " new mAvatarOffset " << mAvatarOffset << LL_ENDL;
}
mLastSkeletonSerialNum = mSkeletonSerialNum;
mRoot->updateWorldMatrixChildren();
}
@ -8397,6 +8385,12 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
}
}
// Root joint
const LLVector3& pos = mRoot->getPosition();
const LLVector3& scale = mRoot->getScale();
apr_file_printf( file, "\t\t<root name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
mRoot->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
// Bones
avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();