diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 5cb03cd2ae89689634fc64e791b4d11b90fe8d37..99fa12fc3268b5ec77e05bf5ade1707b76a93915 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -398,6 +398,8 @@ LLAgent::LLAgent() :
 	mAutoPilotFinishedCallback(NULL),
 	mAutoPilotCallbackData(NULL),
 	
+	mMovementKeysLocked(FALSE),
+
 	mEffectColor(new LLUIColor(LLColor4(0.f, 1.f, 1.f, 1.f))),
 
 	mHaveHomePosition(FALSE),
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index a2e9cedd8841cf4ba11f0d8759859e30923fa905..33088283da50b2bc1c82155bbf3339c974ae82e2 100755
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -515,6 +515,9 @@ class LLAgent : public LLOldEvents::LLObservable
 	void			moveYaw(F32 mag, bool reset_view = true);
 	void			movePitch(F32 mag);
 
+	BOOL			isMovementLocked() const				{ return mMovementKeysLocked; }
+	void			setMovementLocked(BOOL set_locked)	{ mMovementKeysLocked = set_locked; }
+
 	//--------------------------------------------------------------------
  	// Move the avatar's frame
 	//--------------------------------------------------------------------
@@ -569,6 +572,7 @@ class LLAgent : public LLOldEvents::LLObservable
 	void			(*mAutoPilotFinishedCallback)(BOOL, void *);
 	void*			mAutoPilotCallbackData;
 	LLUUID			mLeaderID;
+	BOOL			mMovementKeysLocked;
 	
 /**                    Movement
  **                                                                            **
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index d0939b3eee5f7ddcecc353ad5d3b7caf2ca2f625..ef08db3d33edd0e17904d12dc4e872af18451190 100755
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -32,6 +32,7 @@
 #include "llfloaterreg.h"
 
 // Viewer includes
+#include "llagent.h"
 #include "llagentcamera.h"
 #include "lljoystickbutton.h"
 #include "llviewercontrol.h"
@@ -342,6 +343,8 @@ void LLFloaterCamera::onClose(bool app_quitting)
 
 	switchMode(CAMERA_CTRL_MODE_PAN);
 	mClosed = TRUE;
+
+	gAgent.setMovementLocked(FALSE);
 }
 
 LLFloaterCamera::LLFloaterCamera(const LLSD& val)
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index d38f90015e80f082a9614e20064447a5484c40b9..59e14e6cc01c902d2e256f0e324bd6d96afedd7a 100755
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -424,6 +424,7 @@ void LLJoystickCameraRotate::updateSlop()
 
 BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
 {
+	gAgent.setMovementLocked(TRUE);
 	updateSlop();
 
 	// Set initial offset based on initial click location
@@ -465,6 +466,11 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
 	return LLJoystick::handleMouseDown(x, y, mask);
 }
 
+BOOL LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask)
+{
+	gAgent.setMovementLocked(FALSE);
+	return LLJoystick::handleMouseUp(x, y, mask);
+}
 
 void LLJoystickCameraRotate::onHeldDown()
 {
diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h
index 8d76aa9531cf9704c44af08a62d22099f0113c0c..4e6c774cadfa3c062709a7b318041ea4e6658961 100755
--- a/indra/newview/lljoystickbutton.h
+++ b/indra/newview/lljoystickbutton.h
@@ -146,6 +146,7 @@ class LLJoystickCameraRotate
 	virtual void	setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom );
 
 	virtual BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
+	virtual BOOL	handleMouseUp(S32 x, S32 y, MASK mask);
 	virtual void	onHeldDown();
 	virtual void	draw();
 
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index 35b55029cc5ab51f74307508cb515e2e287d54f7..9766a2552167dc9ca724c84d56769cbda7da7a99 100755
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -149,6 +149,8 @@ void camera_move_forward( EKeystate s );
 
 void agent_push_forward( EKeystate s )
 {
+	if(gAgent.isMovementLocked()) return;
+
 	//in free camera control mode we need to intercept keyboard events for avatar movements
 	if (LLFloaterCamera::inFreeCameraMode())
 	{
@@ -164,6 +166,8 @@ void camera_move_backward( EKeystate s );
 
 void agent_push_backward( EKeystate s )
 {
+	if(gAgent.isMovementLocked()) return;
+
 	//in free camera control mode we need to intercept keyboard events for avatar movements
 	if (LLFloaterCamera::inFreeCameraMode())
 	{
@@ -199,12 +203,14 @@ static void agent_slide_leftright( EKeystate s, S32 direction, LLAgent::EDoubleT
 
 void agent_slide_left( EKeystate s )
 {
+	if(gAgent.isMovementLocked()) return;
 	agent_slide_leftright(s, 1, LLAgent::DOUBLETAP_SLIDELEFT);
 }
 
 
 void agent_slide_right( EKeystate s )
 {
+	if(gAgent.isMovementLocked()) return;
 	agent_slide_leftright(s, -1, LLAgent::DOUBLETAP_SLIDERIGHT);
 }
 
@@ -219,6 +225,8 @@ void agent_turn_left( EKeystate s )
 		return;
 	}
 
+	if(gAgent.isMovementLocked()) return;
+
 	if (LLToolCamera::getInstance()->mouseSteerMode())
 	{
 		agent_slide_left(s);
@@ -247,6 +255,8 @@ void agent_turn_right( EKeystate s )
 		return;
 	}
 
+	if(gAgent.isMovementLocked()) return;
+
 	if (LLToolCamera::getInstance()->mouseSteerMode())
 	{
 		agent_slide_right(s);