summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r--indra/newview/llagent.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 80e5647ace..b413c21033 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -381,6 +381,7 @@ LLAgent::LLAgent() :
mAgentOriginGlobal(),
mPositionGlobal(),
+ mLastTestGlobal(),
mDistanceTraveled(0.F),
mLastPositionGlobal(LLVector3d::zero),
@@ -1070,6 +1071,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);
+ }
}
//-----------------------------------------------------------------------------
@@ -1110,6 +1118,12 @@ const LLVector3 &LLAgent::getPositionAgent()
return mFrameAgent.getOrigin();
}
+boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot_type fn)
+{
+ return mOnPositionChanged.connect(fn);
+}
+
+
//-----------------------------------------------------------------------------
// getRegionsVisited()
//-----------------------------------------------------------------------------