diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-04-29 19:34:39 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-04-29 19:34:39 +0300 |
commit | b6441bf09b9058a799e7581878ee21007323ee0c (patch) | |
tree | bad6f8f26b83643dc0f603a8c774a9ddaedd13c2 /indra/newview/llagent.cpp | |
parent | de696d0213b98110f930cae35a8db005e3d1a061 (diff) | |
parent | f20b22e325ef15e0aa6eef950ba96538bb015568 (diff) |
Merge branch 'DRTVWR-500' into DRTVWR-501-maint
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r-- | indra/newview/llagent.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index bd63240187..f3df79fb6b 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -44,7 +44,6 @@ #include "llchicletbar.h" #include "llconsole.h" #include "lldonotdisturbnotificationstorage.h" -#include "llenvmanager.h" #include "llfirstuse.h" #include "llfloatercamera.h" #include "llfloaterimcontainer.h" @@ -384,6 +383,7 @@ LLAgent::LLAgent() : mAgentOriginGlobal(), mPositionGlobal(), + mLastTestGlobal(), mDistanceTraveled(0.F), mLastPositionGlobal(LLVector3d::zero), @@ -775,7 +775,7 @@ void LLAgent::setFlying(BOOL fly, BOOL fail_sound) // and it's OK if you're already flying if (fail_sound) { - make_ui_sound("UISndBadKeystroke"); + make_ui_sound("UISndBadKeystroke"); } return; } @@ -1097,6 +1097,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent) pos_agent_d.setVec(pos_agent); mPositionGlobal = pos_agent_d + mAgentOriginGlobal; } + + if (((mLastTestGlobal - mPositionGlobal).lengthSquared() > 1.0) && !mOnPositionChanged.empty()) + { // If the position has changed my more than 1 meter since the last time we triggered. + // filters out some noise. + mLastTestGlobal = mPositionGlobal; + mOnPositionChanged(mFrameAgent.getOrigin(), mPositionGlobal); + } } //----------------------------------------------------------------------------- @@ -1137,6 +1144,12 @@ const LLVector3 &LLAgent::getPositionAgent() return mFrameAgent.getOrigin(); } +boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot_type fn) +{ + return mOnPositionChanged.connect(fn); +} + + //----------------------------------------------------------------------------- // getRegionsVisited() //----------------------------------------------------------------------------- |