public override void Update(GameTime gameTime, Camera camera) { var time = (float)gameTime.TotalGameTime.TotalSeconds; var elapsedTime = (float)gameTime.ElapsedGameTime.Milliseconds; // Update camera with collisions processing if (collisions && (oldPosition != null)) { checkBoundries(oldPosition, camera); camera.UpdateViewMatrix(); } // Change view matrix based on camera basicEffect.View = camera.viewMatrix; oldPosition = camera.position; // Update perspective projection matrix basicEffect.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, 1000.0f); // Update Lighting Vector3 sunOrientation = new Vector3((float)Math.Sin(time * sunSpeed), -Math.Abs((float)Math.Cos(time * sunSpeed)), (float)Math.Sin(time * sunSpeed)); // Calculate the position of the sun based on this direction. basicEffect.DirectionalLight0.Direction = sunOrientation; }