when populating shape-info, give the dimensions of the collision model rather than those of the visual model

This commit is contained in:
Seth Alves 2015-04-07 15:47:13 -07:00
parent 3cfafea5ca
commit e8ff727c61

View file

@ -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);
}
}