mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-04 12:30:19 +02:00
dirty physics on useOriginalPivot change, other small fix for compound shapes
This commit is contained in:
parent
56fa143ee6
commit
ace6bf6c5b
2 changed files with 13 additions and 3 deletions
|
@ -456,10 +456,11 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) {
|
||||||
// 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.
|
// also determine the extents of the collision model.
|
||||||
glm::vec3 registrationOffset = dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint());
|
glm::vec3 registrationOffset = dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint());
|
||||||
|
glm::vec3 offset = model->getSnapModelToRegistrationPoint() ? model->getOffset() : glm::vec3(0.0f);
|
||||||
for (int32_t i = 0; i < pointCollection.size(); i++) {
|
for (int32_t i = 0; i < pointCollection.size(); i++) {
|
||||||
for (int32_t j = 0; j < pointCollection[i].size(); j++) {
|
for (int32_t j = 0; j < pointCollection[i].size(); j++) {
|
||||||
// back compensate for registration so we can apply that offset to the shapeInfo later
|
// back compensate for registration so we can apply that offset to the shapeInfo later
|
||||||
pointCollection[i][j] = scaleToFit * (pointCollection[i][j] + model->getOffset()) - registrationOffset;
|
pointCollection[i][j] = scaleToFit * (pointCollection[i][j] + offset) - registrationOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shapeInfo.setParams(type, 0.5f * extents, getCompoundShapeURL() + model->getSnapModelToRegistrationPoint());
|
shapeInfo.setParams(type, 0.5f * extents, getCompoundShapeURL() + model->getSnapModelToRegistrationPoint());
|
||||||
|
|
|
@ -721,10 +721,19 @@ QVector<float> ModelEntityItem::getBlendshapeCoefficientVector() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setUseOriginalPivot(bool value) {
|
void ModelEntityItem::setUseOriginalPivot(bool value) {
|
||||||
|
bool changed = false;
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_needsRenderUpdate |= _useOriginalPivot != value;
|
if (_useOriginalPivot != value) {
|
||||||
|
_needsRenderUpdate = true;
|
||||||
_useOriginalPivot = value;
|
_useOriginalPivot = value;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
markDirtyFlags(Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
||||||
|
locationChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelEntityItem::getUseOriginalPivot() const {
|
bool ModelEntityItem::getUseOriginalPivot() const {
|
||||||
|
|
Loading…
Reference in a new issue