a vector distance node with a max distance range attribute for the target vector.
This C++ node is useful in rigging for Maya to determine how close the controller object is to the specified targetVector.
// create a new vector between the origin and target
MVector outputResultVector = inOriginVector - inVector;
// compute distance between the origin and target vector
double array[3] = {
pow(outputResultVector.x, 2);
pow(outputResultVector.y, 2);
pow(outputResultVector.z, 2);
}
double distance = pow(sum(array), 0.5);
double outputUnit = 1 - (distance / maxDistance);