Sync up most of the realistic mouselook code with alchemy.
This should fix the inverted mouselook when sitting problem Think the bug was in llvoavatar, but keeping in sync is always good for the future overall.
This commit is contained in:
@@ -1293,25 +1293,12 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
|
||||
|
||||
LLVector3 skyward = getReferenceUpVector();
|
||||
|
||||
F32 look_down_limit;
|
||||
F32 look_up_limit = 10.f * DEG_TO_RAD;
|
||||
static const LLCachedControl<bool> useRealisticMouselook(gSavedSettings, "UseRealisticMouselook", false);
|
||||
const F32 look_down_limit = (useRealisticMouselook ? 160.f : (isAgentAvatarValid() && gAgentAvatarp->isSitting() ? 130.f : 179.f)) * DEG_TO_RAD;
|
||||
const F32 look_up_limit = (useRealisticMouselook ? 20.f : 1.f) * DEG_TO_RAD;;
|
||||
|
||||
F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
|
||||
|
||||
if (gAgentCamera.cameraMouselook() && gSavedSettings.getBOOL("UseRealisticMouselook"))
|
||||
{
|
||||
look_down_limit = 160.f * DEG_TO_RAD;
|
||||
look_up_limit = 20.f * DEG_TO_RAD;
|
||||
}
|
||||
else if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
|
||||
{
|
||||
look_down_limit = 130.f * DEG_TO_RAD;
|
||||
}
|
||||
else
|
||||
{
|
||||
look_down_limit = 170.f * DEG_TO_RAD;
|
||||
}
|
||||
|
||||
// clamp pitch to limits
|
||||
if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit))
|
||||
{
|
||||
|
||||
@@ -1493,14 +1493,14 @@ void LLAgentCamera::updateCamera()
|
||||
if (realistic_ml)
|
||||
{
|
||||
LLQuaternion agent_rot(gAgent.getFrameAgent().getQuaternion());
|
||||
if (static_cast<LLViewerObject*>(gAgentAvatarp->getRoot())->flagCameraDecoupled())
|
||||
if (LLViewerObject* parent = static_cast<LLViewerObject*>(gAgentAvatarp->getParent()))
|
||||
if (LLViewerObject* parent = static_cast<LLViewerObject*>(gAgentAvatarp->getParent()))
|
||||
if (static_cast<LLViewerObject*>(gAgentAvatarp->getRoot())->flagCameraDecoupled())
|
||||
agent_rot *= parent->getRenderRotation();
|
||||
LLViewerCamera::getInstance()->updateCameraLocation(head_pos, mCameraUpVector, gAgentAvatarp->mHeadp->getWorldPosition() + LLVector3(1.0, 0.0, 0.0) * agent_rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
const LLVector3 diff = (mCameraPositionAgent - head_pos) * ~gAgentAvatarp->mRoot->getWorldRotation();
|
||||
const LLVector3 diff((mCameraPositionAgent - head_pos) * ~gAgentAvatarp->mRoot->getWorldRotation());
|
||||
gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
|
||||
}
|
||||
|
||||
|
||||
@@ -4149,7 +4149,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
|
||||
static const LLCachedControl<bool> useRealisticMouselook("UseRealisticMouselook");
|
||||
F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, useRealisticMouselook ? s_pelvis_rot_threshold_slow * 2 : s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast);
|
||||
|
||||
if (self_in_mouselook)
|
||||
if (self_in_mouselook && !useRealisticMouselook)
|
||||
{
|
||||
pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user