protected override void OnUpdateFrame(FrameEventArgs args) { base.OnUpdateFrame(args); if (KeyboardState.IsKeyDown(Keys.E)) { _camera.Rotate(0.5f * args.Time); } if (KeyboardState.IsKeyDown(Keys.Q)) { _camera.Rotate(-0.5f * args.Time); } if (KeyboardState.IsKeyDown(Keys.D)) { _camera.Move(0.5f * args.Time, _camera.Right); } if (KeyboardState.IsKeyDown(Keys.A)) { _camera.Move(-0.5f * args.Time, _camera.Right); } if (KeyboardState.IsKeyDown(Keys.W)) { _camera.Move(-0.5f * args.Time, _camera.Forward); } if (KeyboardState.IsKeyDown(Keys.S)) { _camera.Move(0.5f * args.Time, _camera.Forward); } _camera.Update(args.Time); }
void Update() { const int LeftButton = 0; if (Input.GetMouseButton(LeftButton)) { // mouse movement in pixels this frame Vector3 mouseDelta = Input.mousePosition - prevMousePos; // adjust to screen size Vector3 moveDelta = sensitivity * mouseDelta * (360f / Screen.height); cam.Move(moveDelta.x, -moveDelta.y); } float scrollDelta = Input.mouseScrollDelta.y; if (scrollDelta > 0) { cam.ZoomIn(); } else if (scrollDelta < 0) { cam.ZoomOut(); } prevMousePos = Input.mousePosition; }
void Update() { if (mousePressed && !draggingObject) { // mouse movement in pixels this frame Vector3 mouseDelta = Input.mousePosition - _prevMousePos; // adjust to screen size Vector3 moveDelta = mouseDelta * (360f / Screen.height); _cam.Move(moveDelta.x, -moveDelta.y); } _prevMousePos = Input.mousePosition; }