/// <summary>
        /// Initializes coco launcher from MetaKernel.
        /// </summary>
        public static void Start()
        {
            MetaCocoInterop.EnsureMaskExists();
            MetaKernelCocoInterop.ConnectCoco();

            UnityEngine.Application.runInBackground = true;
        }
Пример #2
0
        private void Update()
        {
            if (!Initialized)
            {
                return;
            }

            if (MetaCocoInterop.GetFrameHandsFlatbufferObject(ref _buffer, out _frame))
            {
                _recievedFirstFrame = true;

                meta.types.HandData?incomingRight = null;
                meta.types.HandData?incomingLeft  = null;
                for (int i = 0; i < _frame.HandsLength; i++)
                {
                    switch (_frame.Hands(i).Value.HandType)
                    {
                    case meta.types.HandType.RIGHT:
                        incomingRight = _frame.Hands(i);
                        break;

                    default:
                        incomingLeft = _frame.Hands(i);
                        break;
                    }
                }

                RightHand.UpdateHand(incomingRight);
                LeftHand.UpdateHand(incomingLeft);

                RightHand.UpdateEvents();
                LeftHand.UpdateEvents();
            }
        }
        internal static void ToggleDebugDrawing(bool targetState)
        {
            var targetStateString = targetState ? "true" : "false";
            var attribute         = "draw";

            MetaCocoInterop.meta_update_attribute("HandsDataPreprocessingBlock", attribute, targetStateString);
            MetaCocoInterop.meta_update_attribute("HandSegmentationBlock", attribute, targetStateString);
            MetaCocoInterop.meta_update_attribute("HandTrackingBlock", attribute, targetStateString);
            MetaCocoInterop.meta_update_attribute("HandFeatureExtractionBlock", attribute, targetStateString);
        }