change shape-key when registration point changes so shape cache doesn't incorrectly reuse the old shape

This commit is contained in:
Seth Alves 2016-03-05 08:01:30 -08:00
parent 9346171695
commit 8bc2c76a8b
2 changed files with 10 additions and 3 deletions

View file

@ -700,7 +700,11 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
}
glm::vec3 collisionModelDimensions = box.getDimensions();
info.setParams(type, collisionModelDimensions, _compoundShapeURL);
QString shapeKey = _compoundShapeURL + "," +
QString::number(_registrationPoint.x) + "," +
QString::number(_registrationPoint.y) + "," +
QString::number(_registrationPoint.z);
info.setParams(type, collisionModelDimensions, shapeKey);
info.setConvexHulls(_points);
adjustShapeInfoByRegistration(info);
}

View file

@ -1224,9 +1224,12 @@ void RenderablePolyVoxEntityItem::computeShapeInfoWorkerAsync() {
}
glm::vec3 collisionModelDimensions = box.getDimensions();
QByteArray b64 = _voxelData.toBase64();
QString shapeKey = QString(_voxelData.toBase64()) + "," +
QString::number(_registrationPoint.x) + "," +
QString::number(_registrationPoint.y) + "," +
QString::number(_registrationPoint.z);
_shapeInfoLock.lockForWrite();
_shapeInfo.setParams(SHAPE_TYPE_COMPOUND, collisionModelDimensions, QString(b64));
_shapeInfo.setParams(SHAPE_TYPE_COMPOUND, collisionModelDimensions, shapeKey);
_shapeInfo.setConvexHulls(points);
adjustShapeInfoByRegistration(_shapeInfo);
_shapeInfoLock.unlock();