mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
when populating shape-info, give the dimensions of the collision model rather than those of the visual model
This commit is contained in:
parent
3cfafea5ca
commit
e8ff727c61
1 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue