TerrainDisplay.Game1.Update C# (CSharp) Method

Update() protected method

Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.
protected Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime Provides a snapshot of timing values.
return void
        protected override void Update(GameTime gameTime)
        {
            UpdateAvatarPosition();

            // use mouse navigation

            var w = Form.Width;
            var h = Form.Height;

            if (w != 0 && h != 0 && Form.ActiveForm == Form)
            {
                var x = Mouse.GetState().X;
                var y = Mouse.GetState().Y;

                var cx = w/2;
                var cy = h/2;

                avatarPitch += (y - cy) * MouseSensitivity;
                avatarYaw += (cx - x) * MouseSensitivity;

                Mouse.SetPosition(cx, cy); // move back to center
            }

            //var ray = new Ray(_avatarPosition, Vector3.Down);
            //collider = new Triangle(Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ);
            //var list = tree.GetPotentialColliders(ray, float.MaxValue);
            //foreach (var shape in list)
            //{
            //    if (!shape.IntersectsWith(ray).HasValue) continue;
            //    collider = (Triangle)shape;
            //    break;
            //}
            base.Update(gameTime);
        }