Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
maximusthegreatest's avatar
maximusthegreatest
Honored Guest
5 months ago

JointDistanceActiveState

Hi, I'm trying to make a distance check on both hands using the JointDistanceActiveState.cs script and it looks like it only accepts a threshhold within a distance. I propose there be a Boolean added something like "checkGreaterThanThreshold" and then have the logic change if greater than for that operation.

Example: 

 private bool JointDistanceWithinThreshold()
 {
     if (HandA.GetJointPose(JointIdA, out Pose poseA) &&
         HandB.GetJointPose(JointIdB, out Pose poseB))
     {
         float threshold = _internalState ?
                           _distance + _thresholdWidth * 0.5f :
                           _distance - _thresholdWidth * 0.5f;

         if(checkGreaterThanThreshold)
         {
             return Vector3.Distance(poseA.position, poseB.position) >= threshold;
         } else
         {
             return Vector3.Distance(poseA.position, poseB.position) <= threshold;
         }

         
     }
     else
     {
         return false;
     }
 }