summaryrefslogtreecommitdiff
path: root/indra/newview/llhudeffectlookat.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2025-08-06 16:05:19 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2025-08-06 16:05:19 +0300
commitce9d66cdd18c58c3b26fbebde633ae00732d7f9f (patch)
treefdbc5a913c62265f95e610819637e096f0f85339 /indra/newview/llhudeffectlookat.cpp
parent514b658fde13bb0c0ec862b081eeebf47bace70d (diff)
parent0f68bcd46ca3f2babf94303b80e2be006e4693ae (diff)
Merge branch develop into 2025.06
# Conflicts: # indra/newview/llvoavatar.cpp
Diffstat (limited to 'indra/newview/llhudeffectlookat.cpp')
-rw-r--r--indra/newview/llhudeffectlookat.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index d0d2ee191a..776d2dd31e 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -37,6 +37,7 @@
#include "lldrawable.h"
#include "llviewerobjectlist.h"
#include "llviewercontrol.h"
+#include "llvoavatarself.h"
#include "llrendersphere.h"
#include "llselectmgr.h"
#include "llglheaders.h"
@@ -397,6 +398,21 @@ bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec
return false;
}
+ static LLCachedControl<bool> enable_lookat_hints(gSavedSettings, "EnableLookAtTarget", true);
+ if (!enable_lookat_hints)
+ {
+ // Clear the effect so it doesn't linger around if it gets disabled
+ if (mTargetType != LOOKAT_TARGET_IDLE)
+ {
+ mTargetObject = gAgentAvatarp;
+ mTargetType = LOOKAT_TARGET_IDLE;
+ mTargetOffsetGlobal.set(2.f, 0.f, 0.f);
+ setDuration(3.f);
+ setNeedsSendToSim(true);
+ }
+ return false;
+ }
+
if (target_type >= LOOKAT_NUM_TARGETS)
{
LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL;
@@ -409,6 +425,29 @@ bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec
return false;
}
+ static LLCachedControl<bool> limit_lookat_hints(gSavedSettings, "LimitLookAtTarget", true);
+ // Don't affect the look at if object is gAgentAvatarp (cursor head follow)
+ if (limit_lookat_hints && object != gAgentAvatarp)
+ {
+ // If it is a object
+ if (object)
+ {
+ position += object->getRenderPosition();
+ object = NULL;
+ }
+
+ LLVector3 agentHeadPosition = gAgentAvatarp->mHeadp->getWorldPosition();
+ float dist = (float)dist_vec(agentHeadPosition, position);
+
+ static LLCachedControl<F32> limit_lookat_hints_distance(gSavedSettings, "LimitLookAtTargetDistance", 2.0f);
+ if (dist > limit_lookat_hints_distance)
+ {
+ LLVector3 headOffset = position - agentHeadPosition;
+ headOffset *= limit_lookat_hints_distance / dist;
+ position.setVec(agentHeadPosition + headOffset);
+ }
+ }
+
F32 current_time = mTimer.getElapsedTimeF32();
// type of lookat behavior or target object has changed