public override void RemoveHand(Hand hand)
        {
            var collection = _handIdToPoints[hand.Id];

            _handIdToPoints.Remove(hand.Id);

            //Return the collection to the pool so it can be re-used
            HandPointCollection.Return(collection);
        }
            public static HandPointCollection Create(RigidbodyWarper warper)
            {
                HandPointCollection collection;

                if (_handPointCollectionPool.Count != 0)
                {
                    collection = _handPointCollectionPool.Pop();
                }
                else
                {
                    collection = new HandPointCollection();
                }

                collection.init(warper);
                return(collection);
            }
        public override void AddHand(Hand hand)
        {
            var newCollection = HandPointCollection.Create(_obj.warper);

            _handIdToPoints[hand.Id] = newCollection;

            for (int f = 0; f < NUM_FINGERS; f++)
            {
                Finger            finger     = hand.Fingers[f];
                Finger.FingerType fingerType = finger.Type;

                for (int j = 0; j < NUM_BONES; j++)
                {
                    Bone.BoneType boneType = (Bone.BoneType)j;
                    Bone          bone     = finger.Bone(boneType);

                    Vector3 bonePos = bone.NextJoint.ToVector3();

                    //Global position of the point is just the position of the joint itself
                    newCollection.SetGlobalPosition(bonePos, fingerType, boneType);
                }
            }
        }
 public static void Return(HandPointCollection handPointCollection)
 {
     _handPointCollectionPool.Push(handPointCollection);
 }
 public static void Return(HandPointCollection handPointCollection) {
   _handPointCollectionPool.Push(handPointCollection);
 }
      public static HandPointCollection Create(RigidbodyWarper warper) {
        HandPointCollection collection;
        if (_handPointCollectionPool.Count != 0) {
          collection = _handPointCollectionPool.Pop();
        } else {
          collection = new HandPointCollection();
        }

        collection.init(warper);
        return collection;
      }