fix picks vs. local entities

This commit is contained in:
SamGondelman 2019-01-30 11:42:05 -08:00
parent 834e44dd3a
commit 57ee9786af

View file

@ -141,14 +141,20 @@ bool EntityTreeElement::bestFitBounds(const glm::vec3& minPoint, const glm::vec3
bool checkFilterSettings(const EntityItemPointer& entity, PickFilter searchFilter) {
bool visible = entity->isVisible();
bool collidable = !entity->getCollisionless() && (entity->getShapeType() != SHAPE_TYPE_NONE);
entity::HostType hostType = entity->getEntityHostType();
if ((!searchFilter.doesPickVisible() && visible) || (!searchFilter.doesPickInvisible() && !visible) ||
(!searchFilter.doesPickCollidable() && collidable) || (!searchFilter.doesPickNonCollidable() && !collidable) ||
(!searchFilter.doesPickDomainEntities() && entity->isDomainEntity()) ||
(!searchFilter.doesPickAvatarEntities() && entity->isAvatarEntity()) ||
(!searchFilter.doesPickLocalEntities() && entity->isLocalEntity())) {
(!searchFilter.doesPickDomainEntities() && hostType == entity::HostType::DOMAIN) ||
(!searchFilter.doesPickAvatarEntities() && hostType == entity::HostType::AVATAR) ||
(!searchFilter.doesPickLocalEntities() && hostType == entity::HostType::LOCAL)) {
return false;
}
// We only check the collidable filters for non-local entities, because local entities are always collisionless
bool collidable = !entity->getCollisionless() && (entity->getShapeType() != SHAPE_TYPE_NONE);
if (hostType != entity::HostType::LOCAL) {
if ((!searchFilter.doesPickCollidable() && collidable) || (!searchFilter.doesPickNonCollidable() && !collidable)) {
return false;
}
}
return true;
}