From 34aaf98b535f61ce6bea1cb6841bc1720e3229fb Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 29 Apr 2014 15:16:50 -0700 Subject: [PATCH] cleanup around how boundary shape is computed --- interface/src/renderer/Model.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) 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); }