diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index 7e5f86f484..693923caf6 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -137,7 +137,7 @@ void Hand::simulate(float deltaTime, bool isMine) { } } -const float PALM_COLLISION_RADIUS = 0.01f; +const float PALM_COLLISION_RADIUS = 0.03f; void Hand::updateCollisions() { // use position to obtain the left and right palm indices @@ -168,7 +168,7 @@ void Hand::updateCollisions() { // and the current avatar glm::vec3 owningPenetration; const Model& skeletonModel = _owningAvatar->getSkeletonModel(); - int skipIndex = skeletonModel.getParentJointIndex( + int skipIndex = skeletonModel.getLastFreeJointIndex( (i == leftPalmIndex) ? skeletonModel.getLeftHandJointIndex() : (i == rightPalmIndex) ? skeletonModel.getRightHandJointIndex() : -1); if (_owningAvatar->findSpherePenetration(palm.getPosition(), scaledPalmRadius, owningPenetration, skipIndex)) { diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index 0b2083619c..c0403b6d71 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -458,6 +458,10 @@ int Model::getParentJointIndex(int jointIndex) const { return (isActive() && jointIndex != -1) ? _geometry->getFBXGeometry().joints.at(jointIndex).parentIndex : -1; } +int Model::getLastFreeJointIndex(int jointIndex) const { + return (isActive() && jointIndex != -1) ? _geometry->getFBXGeometry().joints.at(jointIndex).freeLineage.last() : -1; +} + bool Model::getHeadPosition(glm::vec3& headPosition) const { return isActive() && getJointPosition(_geometry->getFBXGeometry().headJointIndex, headPosition); } diff --git a/interface/src/renderer/Model.h b/interface/src/renderer/Model.h index 98bff597a0..3550410492 100644 --- a/interface/src/renderer/Model.h +++ b/interface/src/renderer/Model.h @@ -63,6 +63,9 @@ public: /// Returns the index of the parent of the indexed joint, or -1 if not found. int getParentJointIndex(int jointIndex) const; + /// Returns the index of the last free ancestor or the indexed joint, or -1 if not found. + int getLastFreeJointIndex(int jointIndex) const; + /// Returns the position of the head joint. /// \return whether or not the head was found bool getHeadPosition(glm::vec3& headPosition) const;