Beispiel #1
0
        public void DrawFinger(int fingerIndex, string fingerKey, Hand hand)
        {
            var fingers = hand.fingers;
            //thumb
            LineRenderer lR;

            if (fingers[fingerIndex].GetComponent <LineRenderer>() == null)
            {
                lR = fingers[fingerIndex].AddComponent <LineRenderer>();
                lR.useWorldSpace = false;
                lR.material      = hand.name == "left" ? materialLeft : materialRight;
            }
            else
            {
                lR = fingers[fingerIndex].GetComponent <LineRenderer>();
            }
            lR.positionCount = 4;
            int     index  = 0;
            Vector3 offset = hand.fingers[0].transform.parent.position;

            hand.hand[fingerKey].ForEach(t =>
            {
                lR.SetPosition(index, t.GetPositionVector(ratio) + offset);
                index++;
            });
            lR.startWidth = lineWidth;
            HandPhysics.SetMeshCollider(lR.gameObject);
            HandPhysics.SetMeshCollider(lR.gameObject);
        }
Beispiel #2
0
        public void DrawPalm(Point palmPoint, Hand hand)
        {
            var          fingers = hand.fingers;
            List <Point> points  = new List <Point>();

            for (int i = 0; i < 5; i++)
            {
                Vector3 vect = fingers[i].GetComponent <LineRenderer>().GetPosition(0);
                points.Add(new Point(vect.x, vect.y, vect.z));
            }
            points.Add(palmPoint);

            LineRenderer lR;

            if (fingers[5].GetComponent <LineRenderer>() == null)
            {
                lR = fingers[5].AddComponent <LineRenderer>();
                lR.useWorldSpace = false;
                lR.material      = hand.name == "left" ? materialLeft : materialRight;
            }
            else
            {
                lR = fingers[5].GetComponent <LineRenderer>();
            }
            lR.positionCount = 7;
            int     index  = 0;
            Vector3 offset = hand.fingers[0].transform.parent.position;

            points.ForEach(t =>
            {
                lR.SetPosition(index, t.GetPositionVector(ratio));
                index++;
            });

            Vector3 palmPointVector = points[0].GetPositionVector(ratio);

            lR.SetPosition(index - 1, points[index - 1].GetPositionVector(ratio) + offset);
            lR.SetPosition(index, palmPointVector);
            lR.startWidth = lineWidth;
            HandPhysics.SetMeshCollider(lR.gameObject);
            HandPhysics.SetMeshCollider(lR.gameObject);
        }
Beispiel #3
0
 private void Awake()
 {
     handPhysics = handObject.GetComponent <HandPhysics>();
     interactor  = GetComponent <XRDirectInteractor>();
 }
Beispiel #4
0
 public HandPhysicsReflection(HandPhysics handPhysics)
 {
     HandPhysics          = handPhysics;
     SetIsInitializedFunc = typeof(HandPhysics).CreateSetFieldDelegate <HandPhysics, bool>("_isInitialized");
 }