Beispiel #1
0
    private void GestureRecognizer_ManipulationStarted(ManipulationStartedEventArgs args)
    {
        if (ObjectTouched && TouchedObject != null)
        {
            ObjectManipulationInProgress = true;
            ManipulatedObject            = TouchedObject;
            manipulatedObjectRenderer    = touchedObjectRenderer;
            //Viusal feedback
            UtilitiesScript.Instance.ChangeColorOutline(ManipulatedObject, OutlineManipulateColor);
            //Align the hand with object
            Vector3 newPos = trackingHand.hand.transform.position;
            newPos.y = newPos.y - manipulatedObjectRenderer.bounds.size.y * 0.5f;
            ManipulatedObject.transform.position = newPos;
            //Store initial position of hand and head
            initHandPos = ManipulatedObject.transform.position;
            initUserPos = Camera.main.transform.position;
            //Gather data
            if (DataCollectionMode)
            {
                dataScript.ManipulationStarted(trackingHand.rightHand);
            }

            EventManager.TriggerEvent("manipulation_started");
        }
    }