/// <summary> /// main update for the mouse /// </summary> /// <param name="gameCamera">needs a 3d camera for relative positions</param> public static void Update(BasicCamera gameCamera) { if (gameCamera == null) { throw new Exception("Game camera cannot be null"); } if (!IsActivated) //if the mouse is not activate exit { return; } PostUpdate(.016f); lastRotateCamState = RotateCam; //set last rote if (_lButtonClick) { _mouseRay = gameCamera.GetMouseRay(); if (OnLeftMouseClick != null) { OnLeftMouseClick(_position, _mouseRay); } } if (_rButtonClick) { _mouseRay = gameCamera.GetMouseRay(); if (OnRightMouseClick != null) { OnRightMouseClick(_position, _mouseRay); } } if (gameCamera != null) //if no camear is pressent we can not rotate cam { //code for rotating mouse if (KeyboardAPI.IsKeyDown(Keys.LeftControl) & KeyboardAPI.IsKeyDown(Keys.LeftShift) || //for use on laptops //where there is no middle butotn _mouse.MiddleButton == ButtonState.Pressed && _lmouse.MiddleButton == ButtonState.Pressed) //otherwise use middle button { RotateCam = true; } else { RotateCam = false; } } }