mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
update collision shapes of entities which are children of avatars
This commit is contained in:
parent
c48a67b933
commit
b8587e0711
4 changed files with 28 additions and 2 deletions
|
@ -1963,7 +1963,11 @@ QList<EntityActionPointer> EntityItem::getActionsOfType(EntityActionType typeToG
|
|||
}
|
||||
|
||||
void EntityItem::locationChanged() {
|
||||
requiresRecalcBoxes();
|
||||
_dirtyFlags |= Simulation::DIRTY_TRANSFORM;
|
||||
EntityTreePointer tree = getTree();
|
||||
if (tree) {
|
||||
tree->entityChanged(getThisPointer());
|
||||
}
|
||||
SpatiallyNestable::locationChanged(); // tell all the children, also
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,12 @@ PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
|
|||
}
|
||||
return MOTION_TYPE_DYNAMIC;
|
||||
}
|
||||
return (_entity->isMovingRelativeToParent() || _entity->hasActions()) ? MOTION_TYPE_KINEMATIC : MOTION_TYPE_STATIC;
|
||||
if (_entity->isMovingRelativeToParent() ||
|
||||
_entity->hasActions() ||
|
||||
_entity->hasAncestorOfType(NestableType::Avatar)) {
|
||||
return MOTION_TYPE_KINEMATIC;
|
||||
}
|
||||
return MOTION_TYPE_STATIC;
|
||||
}
|
||||
|
||||
bool EntityMotionState::isMoving() const {
|
||||
|
|
|
@ -879,3 +879,18 @@ void SpatiallyNestable::setLocalTransformAndVelocities(
|
|||
});
|
||||
locationChanged();
|
||||
}
|
||||
|
||||
|
||||
bool SpatiallyNestable::hasAncestorOfType(NestableType nestableType) {
|
||||
if (_nestableType == nestableType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool success;
|
||||
SpatiallyNestablePointer parent = getParentPointer(success);
|
||||
if (!success || !parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent->hasAncestorOfType(nestableType);
|
||||
}
|
||||
|
|
|
@ -142,6 +142,8 @@ public:
|
|||
bool isParentIDValid() const { bool success = false; getParentPointer(success); return success; }
|
||||
virtual SpatialParentTree* getParentTree() const { return nullptr; }
|
||||
|
||||
bool hasAncestorOfType(NestableType nestableType);
|
||||
|
||||
protected:
|
||||
const NestableType _nestableType; // EntityItem or an AvatarData
|
||||
QUuid _id;
|
||||
|
|
Loading…
Reference in a new issue