cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Touch Controller Position To HandTracking Pinch Position

cazforshort
Expert Protege
Hello,
I have a scrip on one of my games that creates an object when you squeeze the trigger on the touch controller. I want to do the same thing again, but this time with the new hand tracking controls. I have the hand tracking fully implemented and button presses seem to work great, but I can't seem to figure out pinch gestures or how to get the location of the tip of the index finger. I think it probably has something to do with this though:

PointerPose.localPosition = _handState.PointerPose.Position.FromFlippedZVector3f();
PointerPose.localRotation = _handState.PointerPose.Orientation.FromFlippedZQuatf();

//Example code to show current method:

    void Update()
    {
        
        var hand = GetComponent<OVRHand>();
        //bool isIndexFingerPinching = hand.GetFingerIsPinching(HandFinger.Index);
       
        bool bDownLeft = OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.LTouch); //This needs to be if left or right pinch
        bool bDownRight = OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.RTouch);


        if (bDownLeft)
        {
            Vector3 position = trackingSpace.TransformPoint(OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch)); //This needs to be the vector location of Hand_IndexTip    
            Vector3 rotation = trackingSpace.TransformDirection(OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch).eulerAngles);
            Instantiate(myPrefab, position, Quaternion.Euler(rotation));

        }

        if (bDownRight)
        {
            Vector3 position = trackingSpace.TransformPoint(OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch));
            Vector3 rotation = trackingSpace.TransformDirection(OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch).eulerAngles);
            Instantiate(myPrefab, position, Quaternion.Euler(rotation));

        }
1 REPLY 1

herrEric
Honored Guest
Did anyone solve this problem?