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 | totalExtents.addPoint(glm::vec3(0.0f)); | 625 | totalExtents.addPoint(glm::vec3(0.0f)); |
| 626 | int numStates = _rig->getJointStateCount(); | 626 | int numStates = _rig->getJointStateCount(); |
| 627 | for (int i = 0; i < numStates; i++) { | 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 | // Each joint contributes a capsule defined by FBXJoint.shapeInfo. | 628 | // Each joint contributes a capsule defined by FBXJoint.shapeInfo. |
| 634 | // For totalExtents we use the capsule endpoints expanded by the radius. | 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 | const FBXJointShapeInfo& shapeInfo = geometry.joints.at(i).shapeInfo; | 632 | const FBXJointShapeInfo& shapeInfo = geometry.joints.at(i).shapeInfo; |
| 636 | for (int j = 0; j < shapeInfo.points.size(); ++j) { | 633 | if (shapeInfo.points.size() > 0) { |
| 637 | glm::vec3 transformedPoint = extractTranslation(jointTransform * glm::translate(shapeInfo.points[j])); | 634 | for (int j = 0; j < shapeInfo.points.size(); ++j) { |
| 638 | vec3 radius(scale * shapeInfo.radius); | 635 | totalExtents.addPoint(extractTranslation(jointTransform * glm::translate(shapeInfo.points[j]))); |
| 639 | totalExtents.addPoint(transformedPoint + radius); | 636 | } |
| 640 | totalExtents.addPoint(transformedPoint - radius); | ||
| 641 | } | 637 | } |
| 642 | // HACK so that default legless robot doesn't knuckle-drag | 638 | // HACK so that default legless robot doesn't knuckle-drag |
| 643 | if (shapeInfo.points.size() == 0 && (state.getName() == "LeftFoot" || state.getName() == "RightFoot")) { | 639 | if (shapeInfo.points.size() == 0 && (state.getName() == "LeftFoot" || state.getName() == "RightFoot")) { |