コード例 #1
0
    // We stop the MLHands module given we no longer need it at this point. But before that, we unsubscribe from the events given we are no longer active at this moment.
    private void OnDisable()
    {
        MLHands.Right.OnKeyPoseBegin -= HandPoseReaction;
        MLHands.Left.OnKeyPoseBegin  -= HandPoseReaction;

        MLHands.Stop();
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        canvas       = GameObject.Find("Canvas");
        fromScroller = false;
        yCoord       = 90;
        xCoord       = 255;
        URLsList     = RecipeInformation.ingredientURLlistoflist;

        URLs = URLsList[0];

        videoURL = RecipeMenuList.SelectedRecipe.steps[step_number].videoUrl;

        MLHands.Start();
        gestures    = new MLHandKeyPose[7];
        gestures[0] = MLHandKeyPose.Ok;
        gestures[1] = MLHandKeyPose.Thumb;
        gestures[2] = MLHandKeyPose.L;
        gestures[3] = MLHandKeyPose.OpenHand;
        gestures[4] = MLHandKeyPose.Pinch;
        gestures[5] = MLHandKeyPose.Finger;
        gestures[6] = MLHandKeyPose.Fist;
        MLHands.KeyPoseManager.EnableKeyPoses(gestures, true, false);

        thisText   = GameObject.Find("Recipe step").GetComponent <Text>();
        audio      = gameObject.AddComponent <AudioSource>();
        audio.clip = notification;
        startPopulateTimers();
        ges_instructions = GameObject.Find("Gesture instruction").GetComponent <Text>();
        ingred           = GameObject.Find("Ingredients").GetComponent <Text>();
    }
コード例 #3
0
 void OnDestroy()
 {
     if (MLHands.IsStarted)
     {
         MLHands.KeyPoseManager.DisableAllKeyPoses();
         MLHands.Stop();
     }
 }
コード例 #4
0
 /// <summary>
 /// Initializes MLHands API.
 /// </summary>
 void OnEnable()
 {
     if (!MLHands.Start())
     {
         Debug.LogError("Error GesturesExample starting MLHands, disabling script.");
         enabled = false;
         return;
     }
 }
コード例 #5
0
 private void Awake()
 {
     if (!(MLHands.Start().IsOk))
     {
         Debug.LogError("Error GesturesKeypointVisualizer starting MLHands, disabling script.");
         enabled = false;
         return;
     }
     _image = GetComponent <Image>();
 }
 // Use this for initialization
 void Start()
 {
     if (!MLHands.Start())
     {
         Debug.Log("MLHands didn't start...bail.");
         return;
     }
     //set gestures to track
     setGesturesToTrack();
 }
コード例 #7
0
 /// <summary>
 /// Stops the communication to the Gestures API and unregisters required events.
 /// </summary>
 void OnDisable()
 {
     if (MLHands.IsStarted)
     {
         // Disable all gestures if MLHands was started
         // and is about to stop
         UpdateGestureStates(false);
     }
     MLHands.Stop();
 }
コード例 #8
0
        /// <summary>
        /// Initializes MLHands API.
        /// </summary>
        void OnEnable()
        {
            MLResult result = MLHands.Start();

            if (!result.IsOk)
            {
                Debug.LogError("Error GesturesExample starting MLHands, disabling script.");
                enabled = false;
                return;
            }
        }
コード例 #9
0
    private int stepIndex;     // marks the recipe step

    void Start()
    {
        MLHands.Start();

        gestures = new MLHandKeyPose[2];

        gestures[0] = MLHandKeyPose.Ok;
        gestures[1] = MLHandKeyPose.Thumb;

        MLHands.KeyPoseManager.EnableKeyPoses(gestures, true, false);
    }
コード例 #10
0
        private void StopMLInput()
        {
            if (MLHands.IsStarted)
            {
                // Stop KeyPose detection
                var keyPoseTypes = Enum.GetValues(typeof(MLHandKeyPose)).Cast <MLHandKeyPose>().ToArray();
                MLHands.KeyPoseManager.EnableKeyPoses(keyPoseTypes, false, true);

                MLHands.Stop();
            }
        }
コード例 #11
0
        /// <summary>
        /// Initializes and finds references to all relevant components in the
        /// scene and registers required events.
        /// </summary>
        void OnEnable()
        {
            if (!MLHands.Start())
            {
                Debug.LogError("Error Gestures starting MLHands, disabling script.");
                enabled = false;
                return;
            }

            UpdateGestureStates(true);
        }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        audio = GetComponent <AudioSource>();
        MLHands.Start();
        MLHandKeyPose[] _gestures = new MLHandKeyPose[]
        {
            MLHandKeyPose.Thumb
        };

        MLHands.KeyPoseManager.EnableKeyPoses(_gestures, true, false);
        initpos = sphere.transform.position;
    }
コード例 #13
0
ファイル: HandTrackScript.cs プロジェクト: eyvind1/MagicLeap
 // Start is called before the first frame update
 private void Start()
 {
     MLHands.Start();
     _gestures    = new MLHandKeyPose[5];
     _gestures[0] = MLHandKeyPose.Ok;
     _gestures[1] = MLHandKeyPose.Finger;
     _gestures[2] = MLHandKeyPose.OpenHand;
     _gestures[3] = MLHandKeyPose.Pinch;
     _gestures[4] = MLHandKeyPose.Thumb;
     MLHands.KeyPoseManager.EnableKeyPoses(_gestures, true, false);
     pos = new Vector3[3];
 }
コード例 #14
0
    private void Start()
    {
        MLHands.Start();

        renderer = GetComponent <MeshRenderer>();
        Debug.Assert(renderer);

        MLHands.KeyPoseManager.EnableKeyPoses(handPoses, true);

        MLHands.KeyPoseManager.SetKeyPointsFilterLevel(keyPointFilterLevel);
        MLHands.KeyPoseManager.SetPoseFilterLevel(poseFilterLevel);
    }
コード例 #15
0
 void StartMlHands()
 {
     MLHands.Start();
     _gestures    = new MLHandKeyPose[7];
     _gestures[0] = MLHandKeyPose.Thumb;
     _gestures[1] = MLHandKeyPose.L;
     _gestures[2] = MLHandKeyPose.OpenHand;
     _gestures[3] = MLHandKeyPose.Pinch;
     _gestures[4] = MLHandKeyPose.Fist;
     _gestures[5] = MLHandKeyPose.Ok;
     _gestures[6] = MLHandKeyPose.Finger;
     MLHands.KeyPoseManager.EnableKeyPoses(_gestures, true, false);
 }
コード例 #16
0
    private void InitializeHands()
    {
        MLResult result = MLHands.Start();

        if (!result.IsOk)
        {
            Debug.LogErrorFormat("Error: HandTrackingUICollision failed starting MLHands, disabling script. Reason: {0}", result);
            enabled = false;
            return;
        }

        _leftHand  = CreateHand();
        _rightHand = CreateHand();
    }
コード例 #17
0
        void Init()
        {
            //hands
            MLHands.Start();

            //controller
            MLInput.OnControllerButtonUp   += HandleOnButtonUp;
            MLInput.OnControllerButtonDown += HandleOnButtonDown;
            _controllerConnectionHandler    = GetComponent <ControllerConnectionHandler>();
            if (_controllerConnectionHandler != null)
            {
                controllerDynamic = GetComponent <DynamicObject>();
            }
        }
コード例 #18
0
        /// <inheritdoc />
        public override void Disable()
        {
            MLInput.OnControllerConnected    -= OnControllerConnected;
            MLInput.OnControllerDisconnected -= OnControllerDisconnected;
            MLInput.OnControllerButtonDown   -= MlInputOnControllerButtonDown;
            MLInput.Stop();
            MLHands.Stop();

            foreach (var activeController in activeControllers)
            {
                RemoveController(activeController.Key, false);
            }

            activeControllers.Clear();
        }