Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 3 files). Show all
Unified · Split
| @@ -625,19 +625,15 @@ void SkeletonModel::computeBoundingShape() { · 624 unmodified lines | ||
| 625 | 625 | totalExtents.addPoint(glm::vec3(0.0f)); |
| 626 | 626 | int numStates = _rig->getJointStateCount(); |
| 627 | 627 | for (int i = 0; i < numStates; i++) { |
| 628 | − const JointState& state = _rig->getJointState(i); | |
| 629 | − | |
| 630 | − const glm::mat4& jointTransform = state.getTransform(); | |
| 631 | − float scale = extractUniformScale(jointTransform); | |
| 632 | − | |
| 633 | 628 | // Each joint contributes a capsule defined by FBXJoint.shapeInfo. |
| 634 | 629 | // For totalExtents we use the capsule endpoints expanded by the radius. |
| 630 | + const JointState& state = _rig->getJointState(i); | |
| 631 | + const glm::mat4& jointTransform = state.getTransform(); | |
| 635 | 632 | const FBXJointShapeInfo& shapeInfo = geometry.joints.at(i).shapeInfo; |
| 636 | − for (int j = 0; j < shapeInfo.points.size(); ++j) { | |
| 637 | − glm::vec3 transformedPoint = extractTranslation(jointTransform * glm::translate(shapeInfo.points[j])); | |
| 638 | − vec3 radius(scale * shapeInfo.radius); | |
| 639 | − totalExtents.addPoint(transformedPoint + radius); | |
| 640 | − totalExtents.addPoint(transformedPoint - radius); | |
| 633 | + if (shapeInfo.points.size() > 0) { | |
| 634 | + for (int j = 0; j < shapeInfo.points.size(); ++j) { | |
| 635 | + totalExtents.addPoint(extractTranslation(jointTransform * glm::translate(shapeInfo.points[j]))); | |
| 636 | + } | |
| 641 | 637 | } |
| 642 | 638 | // HACK so that default legless robot doesn't knuckle-drag |
| 643 | 639 | if (shapeInfo.points.size() == 0 && (state.getName() == "LeftFoot" || state.getName() == "RightFoot")) { |