mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 06:31:01 +02:00
don't bootstrap self with an avatar hold action
This commit is contained in:
parent
bf304a815a
commit
a47aaea37a
3 changed files with 28 additions and 8 deletions
|
@ -1794,12 +1794,27 @@ void EntityItem::computeCollisionGroupAndFinalMask(int16_t& group, int16_t& mask
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t userMask = getCollisionMask();
|
uint8_t userMask = getCollisionMask();
|
||||||
// if this entity is a descendant of MyAvatar, don't collide with MyAvatar. This avoids the
|
if (userMask & USER_COLLISION_GROUP_MY_AVATAR) {
|
||||||
// "bootstrapping" problem where you can shoot yourself across the room by grabbing something
|
// if this entity is a descendant of MyAvatar, don't collide with MyAvatar. This avoids the
|
||||||
// and holding it against your own avatar.
|
// "bootstrapping" problem where you can shoot yourself across the room by grabbing something
|
||||||
QUuid ancestorID = findAncestorOfType(NestableType::Avatar);
|
// and holding it against your own avatar.
|
||||||
if (!ancestorID.isNull() && ancestorID == Physics::getSessionUUID()) {
|
QUuid ancestorID = findAncestorOfType(NestableType::Avatar);
|
||||||
userMask &= ~USER_COLLISION_GROUP_MY_AVATAR;
|
if (!ancestorID.isNull() && ancestorID == Physics::getSessionUUID()) {
|
||||||
|
userMask &= ~USER_COLLISION_GROUP_MY_AVATAR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (userMask & USER_COLLISION_GROUP_MY_AVATAR) {
|
||||||
|
// also, don't bootstrap our own avatar with a hold action
|
||||||
|
QList<EntityActionPointer> holdActions = getActionsOfType(ACTION_TYPE_HOLD);
|
||||||
|
QList<EntityActionPointer>::const_iterator i = holdActions.begin();
|
||||||
|
while (i != holdActions.end()) {
|
||||||
|
EntityActionPointer action = *i;
|
||||||
|
if (action->isMine()) {
|
||||||
|
userMask &= ~USER_COLLISION_GROUP_MY_AVATAR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bool)(userMask & USER_COLLISION_GROUP_MY_AVATAR) !=
|
if ((bool)(userMask & USER_COLLISION_GROUP_MY_AVATAR) !=
|
||||||
|
@ -1904,6 +1919,7 @@ bool EntityItem::addActionInternal(EntitySimulationPointer simulation, EntityAct
|
||||||
if (success) {
|
if (success) {
|
||||||
_allActionsDataCache = newDataCache;
|
_allActionsDataCache = newDataCache;
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
|
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
} else {
|
} else {
|
||||||
qCDebug(entities) << "EntityItem::addActionInternal -- serializeActions failed";
|
qCDebug(entities) << "EntityItem::addActionInternal -- serializeActions failed";
|
||||||
}
|
}
|
||||||
|
@ -1926,6 +1942,7 @@ bool EntityItem::updateAction(EntitySimulationPointer simulation, const QUuid& a
|
||||||
action->setIsMine(true);
|
action->setIsMine(true);
|
||||||
serializeActions(success, _allActionsDataCache);
|
serializeActions(success, _allActionsDataCache);
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
|
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
} else {
|
} else {
|
||||||
qCDebug(entities) << "EntityItem::updateAction failed";
|
qCDebug(entities) << "EntityItem::updateAction failed";
|
||||||
}
|
}
|
||||||
|
@ -1963,6 +1980,7 @@ bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPoi
|
||||||
bool success = true;
|
bool success = true;
|
||||||
serializeActions(success, _allActionsDataCache);
|
serializeActions(success, _allActionsDataCache);
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
|
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
setActionDataNeedsTransmit(true);
|
setActionDataNeedsTransmit(true);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -1983,6 +2001,7 @@ bool EntityItem::clearActions(EntitySimulationPointer simulation) {
|
||||||
_actionsToRemove.clear();
|
_actionsToRemove.clear();
|
||||||
_allActionsDataCache.clear();
|
_allActionsDataCache.clear();
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
|
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2189,7 +2208,7 @@ bool EntityItem::shouldSuppressLocationEdits() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<EntityActionPointer> EntityItem::getActionsOfType(EntityActionType typeToGet) {
|
QList<EntityActionPointer> EntityItem::getActionsOfType(EntityActionType typeToGet) const {
|
||||||
QList<EntityActionPointer> result;
|
QList<EntityActionPointer> result;
|
||||||
|
|
||||||
QHash<QUuid, EntityActionPointer>::const_iterator i = _objectActions.begin();
|
QHash<QUuid, EntityActionPointer>::const_iterator i = _objectActions.begin();
|
||||||
|
|
|
@ -416,7 +416,7 @@ public:
|
||||||
const QUuid& getSourceUUID() const { return _sourceUUID; }
|
const QUuid& getSourceUUID() const { return _sourceUUID; }
|
||||||
bool matchesSourceUUID(const QUuid& sourceUUID) const { return _sourceUUID == sourceUUID; }
|
bool matchesSourceUUID(const QUuid& sourceUUID) const { return _sourceUUID == sourceUUID; }
|
||||||
|
|
||||||
QList<EntityActionPointer> getActionsOfType(EntityActionType typeToGet);
|
QList<EntityActionPointer> getActionsOfType(EntityActionType typeToGet) const;
|
||||||
|
|
||||||
// these are in the frame of this object
|
// these are in the frame of this object
|
||||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override { return glm::quat(); }
|
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override { return glm::quat(); }
|
||||||
|
|
|
@ -133,6 +133,7 @@ QVariantMap ObjectAction::getArguments() {
|
||||||
arguments["::no-motion-state"] = true;
|
arguments["::no-motion-state"] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
arguments["isMine"] = isMine();
|
||||||
});
|
});
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue