bool MovementAdapterWorkerDiscrete::injectMouseMove(const MouseMotion& motion, bool& freezeMouse) { //this will move the entity instead of the mouse Vector<3> direction; direction.zero(); direction.x() = -motion.xRelativeMovement; direction.y() = motion.yRelativeMovement; direction = direction * mMovementSpeed; //hard coded to allow the shift button to increase the speed // if (Input::getSingleton().isKeyDown(SDLK_RSHIFT) || Input::getSingleton().isKeyDown(SDLK_LSHIFT)) { // direction = direction * 5; // } Quaternion orientation = Convert::toWF(getCamera().getOrientation()); //We need to constraint the orientation to only around the z axis. WFMath::Vector<3> rotator(1.0, 0.0, 0.0); rotator.rotate(orientation); WFMath::Quaternion adjustedOrientation; adjustedOrientation.fromRotMatrix(WFMath::RotMatrix<3>().rotationZ(atan2(rotator.y(), rotator.x()))); orientation = adjustedOrientation; //move it relative to the camera direction = direction.rotate(orientation); getBridge()->move(direction);//move the entity a fixed distance for each mouse movement. //we don't want to move the cursor freezeMouse = true; return false; }