summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolpie.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2011-03-14 13:35:04 -0700
committerRichard Linden <none@none>2011-03-14 13:35:04 -0700
commit731037245f5ad7a85c223b5e4a5f56e570bb42fe (patch)
treedd73663d37dbee8ffc5bc8326c6f27c622606786 /indra/newview/lltoolpie.cpp
parentc650b9cf8202ffc63d58bbcbf05f7eddf9ae6c3c (diff)
SOCIAL-715 FIX clicking on own nametag or head causes avatar to walk backward
Diffstat (limited to 'indra/newview/lltoolpie.cpp')
-rw-r--r--indra/newview/lltoolpie.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index c0b5c8de70..959535d224 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -638,6 +638,21 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
&& (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land
|| mPick.mObjectID.notNull())) // or on an object
{
+ // handle special cases of steering picks
+ LLViewerObject* avatar_object = mPick.getObject();
+
+ // get pointer to avatar
+ while (avatar_object && !avatar_object->isAvatar())
+ {
+ avatar_object = (LLViewerObject*)avatar_object->getParent();
+ }
+
+ if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf())
+ {
+ const F64 SELF_CLICK_WALK_DISTANCE = 3.0;
+ // pretend we picked some point a bit in front of avatar
+ mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE;
+ }
gAgentCamera.setFocusOnAvatar(TRUE, TRUE);
mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE);
mAutoPilotDestination->setPositionGlobal(mPick.mPosGlobal);
@@ -1715,25 +1730,23 @@ void LLToolPie::startCameraSteering()
{
mSteerPick = mPick;
- LLPointer<LLViewerObject> pick_object = mSteerPick.getObject();
// handle special cases of steering picks
- if (pick_object)
- {
- LLViewerObject* avatar_object = pick_object;
+ LLViewerObject* avatar_object = mSteerPick.getObject();
- // get pointer to avatar
- while (avatar_object && !avatar_object->isAvatar())
- {
- avatar_object = (LLViewerObject*)avatar_object->getParent();
- }
+ // get pointer to avatar
+ while (avatar_object && !avatar_object->isAvatar())
+ {
+ avatar_object = (LLViewerObject*)avatar_object->getParent();
+ }
- if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf())
- {
- // project pick point a few meters in front of avatar
- mSteerPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * 3.0;
- }
+ // if clicking on own avatar...
+ if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf())
+ {
+ // ...project pick point a few meters in front of avatar
+ mSteerPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * 3.0;
}
- else if (!mSteerPick.isValid())
+
+ if (!mSteerPick.isValid())
{
mSteerPick.mPosGlobal = gAgent.getPosGlobalFromAgent(
LLViewerCamera::instance().getOrigin() + gViewerWindow->mouseDirectionGlobal(mSteerPick.mMousePt.mX, mSteerPick.mMousePt.mY) * 100.f);