public override void Update(ZigEditorInput instance, int mainUserId)
        {
            if (!instance.ReaderInited)
            {
                return;
            }


            userPositions.Clear();

            foreach (ZigTrackedUser currentUser in instance.TrackedUsers.Values)
            {
                // normalize the center of mass to radar dimensions
                Vector3 com           = currentUser.Position;
                Vector2 radarPosition = new Vector2(com.x / RadarRealWorldDimensions.x, -com.z / RadarRealWorldDimensions.y);

                // X axis: 0 in real world is actually 0.5 in radar units (middle of field of view)
                radarPosition.x += 0.5f;

                // clamp
                radarPosition.x = Mathf.Clamp(radarPosition.x, 0.0f, 1.0f);
                radarPosition.y = Mathf.Clamp(radarPosition.y, 0.0f, 1.0f);

                userPositions.Add(radarPosition);
            }
        }
Example #2
0
        public override void Update(ZigEditorInput instance, int mainUserId)
        {
            if (instance == null || ZigEditorInput.Depth == null)
            {
                return;
            }
            if (texture == null)
            {
                Initialize();
            }

            // Get the user Skeleton
            ZigInputJoint[] skeleton = null;
            if (instance.TrackedUsers.ContainsKey(mainUserId))
            {
                skeleton = instance.TrackedUsers[mainUserId].Skeleton;
            }

            // Update the texture
            UpdateTexture(/*ZigEditorInput.Image,*/ skeleton);
        }
Example #3
0
        public override void Update(ZigEditorInput instance, int mainUserId)
        {
            if (instance == null || ZigEditorInput.Depth == null)
            {
                return;
            }
            if (texture == null)
            {
                Initialize();
            }

            if (UseHistogram)
            {
                UpdateHistogram(ZigEditorInput.Depth);
            }
            else
            {
                depthToColor[0] = Color.black;
                for (int i = 1; i < MaxDepth; i++)
                {
                    float intensity = 1.0f - (i / (float)MaxDepth);

                    depthToColor[i].r = (byte)(BaseColor.r * intensity);
                    depthToColor[i].g = (byte)(BaseColor.g * intensity);
                    depthToColor[i].b = (byte)(BaseColor.b * intensity);
                    depthToColor[i].a = 255;
                }
            }

            // Get the user Skeleton
            ZigInputJoint[] skeleton = null;
            if (instance.TrackedUsers.ContainsKey(mainUserId))
            {
                skeleton = instance.TrackedUsers[mainUserId].Skeleton;
            }

            UpdateTexture(ZigEditorInput.Depth, skeleton);
        }
Example #4
0
 public virtual void Update(ZigEditorInput instance, int mainUserId)
 {
 }