예제 #1
0
        void kinectService_SkeletonUpdated(object sender, SkeletonEventArgs e)
        {
            if (App.Current.MainWindow != null)
            {
                this.UserIsInRange = this.GetUserIsInRange(e.TorsoPosition);
                this.UserPointColor = this.UserIsInRange
                    ? Color.FromArgb(255, 0, 255, 0) : Color.FromArgb(255, 255, 0, 0);

                this.TorsoOffsetX =
                    (this.BoundsDisplaySize / 2) * e.TorsoPosition.X / (this.BoundsWidth / 2);
                this.TorsoOffsetZ = (this.BoundsDisplaySize / 2) * (e.TorsoPosition.Z
                    - (this.MinDistanceFromCamera + this.BoundsDepth / 2)) / (this.BoundsDepth / 2);

                if (this.UserIsInRange)
                {
                    var midpointX = App.Current.MainWindow.Width / 2;
                    var midpointY = App.Current.MainWindow.Height / 2;

                    this.HandOffsetX = midpointX + (e.RightHandPosition.X * 500);
                    this.HandOffsetY = midpointY - (e.RightHandPosition.Y * 500);
                }
            }
        }