mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 17:43:09 +02:00
if something is a child of the local avatar, never let it collide with MY_AVATAR
This commit is contained in:
parent
01ff3f14b6
commit
45a26d599f
3 changed files with 7 additions and 4 deletions
|
@ -1780,7 +1780,6 @@ void EntityItem::updateCreated(uint64_t value) {
|
|||
}
|
||||
|
||||
void EntityItem::computeCollisionGroupAndFinalMask(int16_t& group, int16_t& mask) const {
|
||||
// TODO: detect attachment status and adopt group of wearer
|
||||
if (_collisionless) {
|
||||
group = BULLET_COLLISION_GROUP_COLLISIONLESS;
|
||||
mask = 0;
|
||||
|
@ -1794,10 +1793,14 @@ void EntityItem::computeCollisionGroupAndFinalMask(int16_t& group, int16_t& mask
|
|||
}
|
||||
|
||||
uint8_t userMask = getCollisionMask();
|
||||
if (hasAncestorOfType(NestableType::Avatar)) {
|
||||
userMask &= ~USER_COLLISION_GROUP_MY_AVATAR;
|
||||
}
|
||||
|
||||
if ((bool)(userMask & USER_COLLISION_GROUP_MY_AVATAR) !=
|
||||
(bool)(userMask & USER_COLLISION_GROUP_OTHER_AVATAR)) {
|
||||
// asymmetric avatar collision mask bits
|
||||
if (!getSimulatorID().isNull() && (!getSimulatorID().isNull()) && getSimulatorID() != Physics::getSessionUUID()) {
|
||||
if (!getSimulatorID().isNull() && getSimulatorID() != Physics::getSessionUUID()) {
|
||||
// someone else owns the simulation, so we toggle the avatar bits (swap interpretation)
|
||||
userMask ^= USER_COLLISION_MASK_AVATARS | ~userMask;
|
||||
}
|
||||
|
|
|
@ -1015,7 +1015,7 @@ AACube SpatiallyNestable::getQueryAACube() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool SpatiallyNestable::hasAncestorOfType(NestableType nestableType) {
|
||||
bool SpatiallyNestable::hasAncestorOfType(NestableType nestableType) const {
|
||||
bool success;
|
||||
SpatiallyNestablePointer parent = getParentPointer(success);
|
||||
if (!success || !parent) {
|
||||
|
|
|
@ -163,7 +163,7 @@ public:
|
|||
bool isParentIDValid() const { bool success = false; getParentPointer(success); return success; }
|
||||
virtual SpatialParentTree* getParentTree() const { return nullptr; }
|
||||
|
||||
bool hasAncestorOfType(NestableType nestableType);
|
||||
bool hasAncestorOfType(NestableType nestableType) const;
|
||||
SpatiallyNestablePointer getParentPointer(bool& success) const;
|
||||
static SpatiallyNestablePointer findByID(QUuid id, bool& success);
|
||||
|
||||
|
|
Loading…
Reference in a new issue