don't cauterize head-children when they are grabbed

This commit is contained in:
Seth Alves 2019-01-16 16:26:40 -08:00 committed by Andrew Meadows
parent c8e9bff03a
commit 4fbc257be0
4 changed files with 5 additions and 3 deletions

View file

@ -773,7 +773,7 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
auto headBoneSet = _skeletonModel->getCauterizeBoneSet(); auto headBoneSet = _skeletonModel->getCauterizeBoneSet();
forEachChild([&](SpatiallyNestablePointer object) { forEachChild([&](SpatiallyNestablePointer object) {
bool isChildOfHead = headBoneSet.find(object->getParentJointIndex()) != headBoneSet.end(); bool isChildOfHead = headBoneSet.find(object->getParentJointIndex()) != headBoneSet.end();
if (isChildOfHead) { if (isChildOfHead && !object->hasGrabs()) {
// Cauterize or display children of head per head drawing state. // Cauterize or display children of head per head drawing state.
updateChildCauterization(object, !_prevShouldDrawHead); updateChildCauterization(object, !_prevShouldDrawHead);
object->forEachDescendant([&](SpatiallyNestablePointer descendant) { object->forEachDescendant([&](SpatiallyNestablePointer descendant) {

View file

@ -1869,8 +1869,6 @@ private:
bool _enableDebugDrawIKChains { false }; bool _enableDebugDrawIKChains { false };
bool _enableDebugDrawDetailedCollision { false }; bool _enableDebugDrawDetailedCollision { false };
mutable bool _cauterizationNeedsUpdate; // do we need to scan children and update their "cauterized" state?
AudioListenerMode _audioListenerMode; AudioListenerMode _audioListenerMode;
glm::vec3 _customListenPosition; glm::vec3 _customListenPosition;
glm::quat _customListenOrientation; glm::quat _customListenOrientation;

View file

@ -385,6 +385,7 @@ void Avatar::updateGrabs() {
entityTree->updateEntityQueryAACube(target, packetSender, force, iShouldTellServer); entityTree->updateEntityQueryAACube(target, packetSender, force, iShouldTellServer);
}); });
} }
_cauterizationNeedsUpdate = true;
} }
_avatarGrabs.remove(grabID); _avatarGrabs.remove(grabID);
_changedAvatarGrabs.remove(grabID); _changedAvatarGrabs.remove(grabID);
@ -402,6 +403,7 @@ void Avatar::updateGrabs() {
target->addGrab(grab); target->addGrab(grab);
// only clear this entry from the _changedAvatarGrabs if we found the entity. // only clear this entry from the _changedAvatarGrabs if we found the entity.
changeItr.remove(); changeItr.remove();
_cauterizationNeedsUpdate = true;
} }
} }
}); });

View file

@ -536,6 +536,8 @@ protected:
glm::vec3 _worldUpDirection { Vectors::UP }; glm::vec3 _worldUpDirection { Vectors::UP };
bool _moving { false }; ///< set when position is changing bool _moving { false }; ///< set when position is changing
mutable bool _cauterizationNeedsUpdate; // do we need to scan children and update their "cauterized" state?
// protected methods... // protected methods...
bool isLookingAtMe(AvatarSharedPointer avatar) const; bool isLookingAtMe(AvatarSharedPointer avatar) const;
void updateGrabs(); void updateGrabs();