Ejemplo n.º 1
0
 public void RemoveProvider(AComponentData provider)
 {
     providers.Remove(provider);
     if (provider is LeftFootData)
     {
         leftFoot = null;
     }
     else if (provider is RightFootData)
     {
         rightFoot = null;
     }
     else if (provider is HipData)
     {
         hipData = null;
     }
     else if (provider is LeftHandData)
     {
         leftHand = null;
     }
     else if (provider is RightHandData)
     {
         rightHand = null;
     }
     else if (provider is HeadData)
     {
         headData = null;
     }
 }
Ejemplo n.º 2
0
        private void InitFeet()
        {
            leftFootData  = new LeftFootData(() => GetLeftFootPosition(), () => GetLeftFootRotation() /*GetLeftFootRotation()*/);
            rightFootData = new RightFootData(() => GetRightFootPosition(), () => GetRightFootRotation() /*GetRightFootRotation()*/);
            hipData       = new HipData(() => GetCenterPosition(), () => GetCenterRotation());
            leftHandData  = new LeftHandData(() => GetLeftHandPosition(), () => GetLeftHandRotation());
            rightHandData = new RightHandData(() => GetRightHandPosition(), () => GetRightHandRotation());

            UnityModelDataManager mdm = GetComponent <UnityModelDataManager>();

            mdm.AddProvider(leftFootData);
            mdm.AddProvider(rightFootData);
            mdm.AddProvider(hipData);
            mdm.AddProvider(leftHandData);
            mdm.AddProvider(rightHandData);

            leftFoot  = Instantiate(playerFootPrefab);
            rightFoot = Instantiate(playerFootPrefab);

            if (useLineRenderers)
            {
                leftFoot.InitLineRenderer(Color.red);
                rightFoot.InitLineRenderer(Color.blue);
            }
        }
Ejemplo n.º 3
0
 public void AddProvider(AComponentData provider)
 {
     providers.Add(provider);
     if (provider is LeftFootData)
     {
         leftFoot = (LeftFootData)provider;
     }
     else if (provider is RightFootData)
     {
         rightFoot = (RightFootData)provider;
     }
     else if (provider is HipData)
     {
         hipData = (HipData)provider;
     }
     else if (provider is LeftHandData)
     {
         leftHand = (LeftHandData)provider;
     }
     else if (provider is RightHandData)
     {
         rightHand = (RightHandData)provider;
     }
     else if (provider is HeadData)
     {
         headData = (HeadData)provider;
     }
 }
Ejemplo n.º 4
0
        private void InitFeet()
        {
            //yield return new WaitUntil(mdm != null);
            leftFootData  = new LeftFootData(() => GetLeftFootPosition(), () => GetLeftFootRotation() /*GetLeftFootRotation()*/);
            rightFootData = new RightFootData(() => GetRightFootPosition(), () => GetRightFootRotation() /*GetRightFootRotation()*/);
            hipData       = new HipData(() => GetCenterPosition(), () => GetCenterRotation());
            leftHandData  = new LeftHandData(() => GetLeftHandPosition(), () => GetLeftHandRotation());
            rightHandData = new RightHandData(() => GetRightHandPosition(), () => GetRightHandRotation());

            UnityModelDataManager mdm = GetComponent <UnityModelDataManager>();

            print("mdm " + mdm + " lf " + leftFootData);
            mdm.AddProvider(leftFootData);
            mdm.AddProvider(rightFootData);
            mdm.AddProvider(hipData);
            mdm.AddProvider(leftHandData);
            mdm.AddProvider(rightHandData);

            // comments are approximations which can be used if calibration with trackers does not provide satisfying results
            leftFootDirectionCorrection    = /*vLeftFoot.up;*/ new Vector3(0, -0.3f, 0.1f);
            leftFootDirectionCorrection.z  = 0;
            rightFootDirectionCorrection   = /*vRightFoot.up;*/ new Vector3(0, -0.3f, 0.1f);
            rightFootDirectionCorrection.z = 0;

            print("Left foot orientation correction: " + leftFootDirectionCorrection);
            print("Right foot orientation correction: " + rightFootDirectionCorrection);


            lastLeftFootPosition  = viveLeftFoot.position;
            lastRightFootPosition = viveRightFoot.position;

            TrackViveFeet();
        }