Fixed ray intersections with Local entities.

Previously, rays *always* intersected with Local entities, regardless of whether the pick filter requested
to hit on collidable or noncollidable entities. But Local entities are always collisionless, so a pick filter
for collidable entities shouldn't intersect with Local entities.
This commit is contained in:
Oren Hurvitz 2019-03-28 09:38:28 +02:00
parent 8ff47659d3
commit 81f28b3b2c

View file

@ -148,13 +148,20 @@ bool EntityTreeElement::checkFilterSettings(const EntityItemPointer& entity, Pic
(!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 ((collidable && !searchFilter.doesPickCollidable()) || (!collidable && !searchFilter.doesPickNonCollidable())) {
return false;
}
bool collidable;
if (hostType == entity::HostType::LOCAL) {
// Local entities are always collisionless
collidable = false;
}
else {
collidable = !entity->getCollisionless() && (entity->getShapeType() != SHAPE_TYPE_NONE);
}
if ((collidable && !searchFilter.doesPickCollidable()) || (!collidable && !searchFilter.doesPickNonCollidable())) {
return false;
}
return true;
}