update collision shapes of entities which are children of avatars

This commit is contained in:
Seth Alves 2016-04-04 16:06:53 -07:00
parent c48a67b933
commit b8587e0711
4 changed files with 28 additions and 2 deletions

View file

@ -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
}

View file

@ -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 {

View file

@ -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);
}

View file

@ -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;