diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index 3484ac5fc8..43beca5cd6 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -542,18 +542,10 @@ void Model::rebuildShapes() { capsule->setRotation(combinedRotations[i] * joint.shapeRotation); _jointShapes.push_back(capsule); - glm::vec3 endPoint; - capsule->getEndPoint(endPoint); - glm::vec3 startPoint; - capsule->getStartPoint(startPoint); - - // add some points that bound a sphere at the center of the capsule - glm::vec3 axis = glm::vec3(radius); - shapeExtents.addPoint(worldPosition + axis); - shapeExtents.addPoint(worldPosition - axis); - // add the two furthest surface points of the capsule - axis = (halfHeight + radius) * glm::normalize(endPoint - startPoint); + glm::vec3 axis; + capsule->computeNormalizedAxis(axis); + axis = halfHeight * axis + glm::vec3(radius); shapeExtents.addPoint(worldPosition + axis); shapeExtents.addPoint(worldPosition - axis); @@ -587,7 +579,7 @@ void Model::rebuildShapes() { glm::quat inverseRotation = glm::inverse(_rotation); glm::vec3 rootPosition = extractTranslation(transforms[rootIndex]); _boundingShapeLocalOffset = inverseRotation * (0.5f * (totalExtents.maximum + totalExtents.minimum) - rootPosition); - _boundingShape.setPosition(_translation - _rotation * _boundingShapeLocalOffset); + _boundingShape.setPosition(_translation + _rotation * _boundingShapeLocalOffset); _boundingShape.setRotation(_rotation); }