merge with upstream, and clean code

This commit is contained in:
samcake 2017-11-06 17:02:10 -08:00
parent eaed02b144
commit f665bf384b

View file

@ -728,21 +728,19 @@ void Avatar::simulateAttachments(float deltaTime) {
glm::quat jointRotation;
if (attachment.isSoft) {
// soft attachments do not have transform offsets
// model->setTranslation(getPosition());
// model->setRotation(getOrientation() * Quaternions::Y_180);
model->setTransformNoUpdateRenderItems(Transform(getOrientation() * Quaternions::Y_180, glm::vec3(1.0), getPosition()));
model->simulate(deltaTime);
model->updateRenderItems();
} else {
if (_skeletonModel->getJointPositionInWorldFrame(jointIndex, jointPosition) &&
_skeletonModel->getJointRotationInWorldFrame(jointIndex, jointRotation)) {
model->setTranslation(jointPosition + jointRotation * attachment.translation * getModelScale());
model->setRotation(jointRotation * attachment.rotation);
model->setTransformNoUpdateRenderItems(Transform(jointRotation * attachment.rotation, glm::vec3(1.0), jointPosition + jointRotation * attachment.translation * getModelScale()));
float scale = getModelScale() * attachment.scale;
model->setScaleToFit(true, model->getNaturalDimensions() * scale, true); // hack to force rescale
model->setSnapModelToCenter(false); // hack to force resnap
model->setSnapModelToCenter(true);
model->simulate(deltaTime);
model->updateRenderItems();
}
}
}