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:
@@ -995,6 +995,17 @@ Found in Advanced->Rendering->Info Displays</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>UseRealisticMouselook</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Use a realistic first person view, this prevents your camera from being the center of everything and your avatar always beeing locked below you, it allows your Avatar to move around freely in mouselook while your camera will follow it around. Prepare your seatbelts for an awesome shaky View! May break with certain super unrealistic animations.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>LogShowHistoryLines</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
@@ -3058,6 +3069,17 @@ This should be as low as possible, but too low may break functionality</string>
|
||||
<key>Value</key>
|
||||
<integer>2</integer>
|
||||
</map>
|
||||
<key>AvatarRotateThresholdMouselook</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when in mouselook (degrees)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>120</real>
|
||||
</map>
|
||||
<key>AvatarBakedTextureUploadTimeout</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -1298,7 +1298,12 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
|
||||
|
||||
F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
|
||||
|
||||
if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -4130,12 +4130,13 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
|
||||
|
||||
static const LLCachedControl<F32> s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow");
|
||||
static const LLCachedControl<F32> s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast");
|
||||
static const LLCachedControl<F32> s_pelvis_rot_threshold_ml(gSavedSettings, "AvatarRotateThresholdMouselook", 120.f);
|
||||
|
||||
F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast);
|
||||
|
||||
if (self_in_mouselook)
|
||||
{
|
||||
pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR;
|
||||
pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, s_pelvis_rot_threshold_ml, s_pelvis_rot_threshold_fast);
|
||||
}
|
||||
pelvis_rot_threshold *= DEG_TO_RAD;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<slider_bar bottom="-26" follows="top" height="16" increment="0.25" initial_val="2" left="276" max_val="15" min_val="0" name="mouse_sensitivity" width="128"/>
|
||||
<check_box bottom_delta="-18" follows="top" height="16" label="Invert Mouse" left="148" name="invert_mouse"/>
|
||||
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Show Avatar in Mouselook" name="first_person_avatar_visible"/>
|
||||
<check_box bottom_delta="-18" follows="top" height="16" control_name="UseRealisticMouselook" label="Use 'realistic' Camera behavior in Mouselook" name="UseRealisticMouselook"/>
|
||||
<text bottom_delta="-18" follows="top" height="16" name="UI Hidden in mouselook:">UI Hidden in mouselook:</text>
|
||||
<check_box bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesFloaters" name="mouselook_hides_floaters" label="Floaters"/>
|
||||
<check_box left_delta="80" bottom_delta="0" follows="top" height="16" control_name="LiruMouselookHidesNotices" name="mouselook_hides_notices" label="Notices"/>
|
||||
|
||||
Reference in New Issue
Block a user