Brought in Realistic Mouselook option from Black Dragon
Look at the top area of Input & Camera preferences Aside from tweaks to the code, all credit to Niran.
This commit is contained in:
@@ -1178,7 +1178,9 @@ void LLAgentCamera::updateCamera()
|
||||
|
||||
validateFocusObject();
|
||||
|
||||
if (isAgentAvatarValid() &&
|
||||
bool realistic_ml(gSavedSettings.getBOOL("UseRealisticMouselook"));
|
||||
if (isAgentAvatarValid() &&
|
||||
!realistic_ml &&
|
||||
gAgentAvatarp->isSitting() &&
|
||||
camera_mode == CAMERA_MODE_MOUSELOOK)
|
||||
{
|
||||
@@ -1461,13 +1463,11 @@ void LLAgentCamera::updateCamera()
|
||||
}
|
||||
gAgent.setLastPositionGlobal(global_pos);
|
||||
|
||||
if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook())
|
||||
if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && (realistic_ml || !gAgentAvatarp->isSitting()) && cameraMouselook())
|
||||
{
|
||||
LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() +
|
||||
LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() +
|
||||
LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation();
|
||||
LLVector3 diff = mCameraPositionAgent - head_pos;
|
||||
diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation();
|
||||
|
||||
LLJoint* torso_joint = gAgentAvatarp->mTorsop;
|
||||
LLJoint* chest_joint = gAgentAvatarp->mChestp;
|
||||
@@ -1489,7 +1489,21 @@ void LLAgentCamera::updateCamera()
|
||||
diff.mV[VZ] = 0.f;
|
||||
}*/
|
||||
|
||||
gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
|
||||
if (realistic_ml)
|
||||
{
|
||||
LLQuaternion agent_rot(gAgent.getFrameAgent().getQuaternion());
|
||||
if (isAgentAvatarValid())
|
||||
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
|
||||
{
|
||||
LLVector3 diff = mCameraPositionAgent - head_pos;
|
||||
diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation();
|
||||
gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
|
||||
}
|
||||
|
||||
gAgentAvatarp->mRoot->updateWorldMatrixChildren();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user