mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Fixed Safe Landing interaction with Local entities.
Local entities are collisionless, so they shouldn't affect Safe Landing since it specifies that it only wants to find COLLIDABLE entities. However, due to the requirement to support legacy behavior, picks for COLLIDABLE entities *do* intersect Local entities. In order to prevent this, we have to explicitly request only intersections with Domain or Avatar entities. For more information about this, see this Pull Request: https://github.com/highfidelity/hifi/pull/15282
This commit is contained in:
parent
81f28b3b2c
commit
32406b8399
2 changed files with 12 additions and 14 deletions
|
@ -3742,7 +3742,8 @@ bool MyAvatar::requiresSafeLanding(const glm::vec3& positionIn, glm::vec3& bette
|
|||
// See https://highfidelity.fogbugz.com/f/cases/5003/findRayIntersection-has-option-to-use-collidableOnly-but-doesn-t-actually-use-colliders
|
||||
QVariantMap extraInfo;
|
||||
EntityItemID entityID = entityTree->evalRayIntersection(startPointIn, directionIn, include, ignore,
|
||||
PickFilter(PickFilter::getBitMask(PickFilter::FlagBit::COLLIDABLE) | PickFilter::getBitMask(PickFilter::FlagBit::PRECISE)),
|
||||
PickFilter(PickFilter::getBitMask(PickFilter::FlagBit::COLLIDABLE) | PickFilter::getBitMask(PickFilter::FlagBit::PRECISE)
|
||||
| PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) | PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES)), // exclude Local entities
|
||||
element, distance, face, normalOut, extraInfo, lockType, accurateResult);
|
||||
if (entityID.isNull()) {
|
||||
return false;
|
||||
|
|
|
@ -148,20 +148,17 @@ bool EntityTreeElement::checkFilterSettings(const EntityItemPointer& entity, Pic
|
|||
(!searchFilter.doesPickLocalEntities() && hostType == entity::HostType::LOCAL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool collidable;
|
||||
if (hostType == entity::HostType::LOCAL) {
|
||||
// Local entities are always collisionless
|
||||
collidable = false;
|
||||
// We only check the collidable filters for non-local entities, because local entities are always collisionless,
|
||||
// but picks always include COLLIDABLE (see PickScriptingInterface::getPickFilter()), so if we were to respect
|
||||
// the getCollisionless() property of Local entities then we would *never* intersect them in a pick.
|
||||
// An unfortunate side effect of the following code is that Local entities are intersected even if the
|
||||
// pick explicitly requested only COLLIDABLE entities (but, again, Local entities are always collisionless).
|
||||
if (hostType != entity::HostType::LOCAL) {
|
||||
bool collidable = !entity->getCollisionless() && (entity->getShapeType() != SHAPE_TYPE_NONE);
|
||||
if ((collidable && !searchFilter.doesPickCollidable()) || (!collidable && !searchFilter.doesPickNonCollidable())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
collidable = !entity->getCollisionless() && (entity->getShapeType() != SHAPE_TYPE_NONE);
|
||||
}
|
||||
|
||||
if ((collidable && !searchFilter.doesPickCollidable()) || (!collidable && !searchFilter.doesPickNonCollidable())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue