internal void Update(GameTime gameTime) { float delta = (float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000f; game.renderSystem.ActiveCamera = camera; form.Text = mouseState.Position.ToString(); camera.Update(mouseState, gameTime); if (SelectedEntity != null) { if (mouseState.LeftButton == MouseButtonState.Pressed && mouseState.onControl) { float? length; Vector3 camPosition = game.GraphicsDevice.Viewport.Unproject(new Vector3(mouseState.Position, 0), camera.Projection, camera.View, Matrix.Identity); switch (camera.ProjectionType) { case CameraProjectionType.Perspective: if ((length = new Ray(camera.Position, camPosition - camera.Position).Intersects( new Plane(0, 1, 0, 0))) > 0) { SelectedEntity.GlobalTransform.Position = camPosition + (camPosition - camera.Position) * (float)length; } break; case CameraProjectionType.Orthographic: SelectedEntity.GlobalTransform.Position = new Vector3(camPosition.X, camPosition.Y, SelectedEntity.GlobalTransform.Position.Z); break; } //TODO } if (Keyboard.GetState().IsKeyDown(XNAKeys.Q)) { SelectedEntity.Transform.Rotation += new Vector3(rotationSpeed, 0, 0) * delta; } if (Keyboard.GetState().IsKeyDown(XNAKeys.E)) { SelectedEntity.Transform.Rotation -= new Vector3(rotationSpeed, 0, 0) * delta; } if (Keyboard.GetState().IsKeyDown(XNAKeys.Z)) { SelectedEntity.Transform.Rotation += new Vector3(0, rotationSpeed, 0) * delta; } if (Keyboard.GetState().IsKeyDown(XNAKeys.X)) { SelectedEntity.Transform.Rotation -= new Vector3(0, rotationSpeed, 0) * delta; } if (Keyboard.GetState().IsKeyDown(XNAKeys.F)) { SelectedEntity.Transform.Rotation += new Vector3(0, 0, rotationSpeed) * delta; } if (Keyboard.GetState().IsKeyDown(XNAKeys.G)) { SelectedEntity.Transform.Rotation -= new Vector3(0, 0, rotationSpeed) * delta; } } mouseState.Update(); //form.Text = camera.Forward.ToString() + camera.Position; }