From e8ff727c61323143eaa3b709d71510a324c81268 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 7 Apr 2015 15:47:13 -0700 Subject: [PATCH] when populating shape-info, give the dimensions of the collision model rather than those of the visual model --- .../entities-renderer/src/RenderableModelEntityItem.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 4cd625c93f..73968607f7 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -394,17 +394,21 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) { // collision model's extents). glm::vec3 scale = _dimensions / renderGeometry.getUnscaledMeshExtents().size(); - // multiply each point by scale before handing the point-set off to the physics engine + // multiply each point by scale before handing the point-set off to the physics engine. + // also determine the extents of the collision model. + AABox box; for (int i = 0; i < _points.size(); i++) { for (int j = 0; j < _points[i].size(); j++) { // compensate for registraion _points[i][j] += _model->getOffset(); // scale so the collision points match the model points _points[i][j] *= scale; + box += _points[i][j]; } } - info.setParams(getShapeType(), _dimensions, _collisionModelURL); + glm::vec3 collisionModelDimensions = box.getDimensions(); + info.setParams(getShapeType(), collisionModelDimensions, _collisionModelURL); info.setConvexHulls(_points); } }