mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 11:14:01 +02:00
flag collision group/mask dirty after grab
This commit is contained in:
parent
9e862ba55b
commit
ff746c3141
1 changed files with 23 additions and 10 deletions
|
@ -1897,7 +1897,7 @@ glm::vec3 EntityItem::getUnscaledDimensions() const {
|
||||||
void EntityItem::setRotation(glm::quat rotation) {
|
void EntityItem::setRotation(glm::quat rotation) {
|
||||||
if (getLocalOrientation() != rotation) {
|
if (getLocalOrientation() != rotation) {
|
||||||
setLocalOrientation(rotation);
|
setLocalOrientation(rotation);
|
||||||
_flags |= Simulation::DIRTY_ROTATION;
|
markDirtyFlags(Simulation::DIRTY_ROTATION);
|
||||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||||
if (object->getNestableType() == NestableType::Entity) {
|
if (object->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||||
|
@ -1927,7 +1927,7 @@ void EntityItem::setVelocity(const glm::vec3& value) {
|
||||||
velocity = value;
|
velocity = value;
|
||||||
}
|
}
|
||||||
setLocalVelocity(velocity);
|
setLocalVelocity(velocity);
|
||||||
_flags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
markDirtyFlags(Simulation::DIRTY_LINEAR_VELOCITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1982,7 +1982,7 @@ void EntityItem::setAngularVelocity(const glm::vec3& value) {
|
||||||
angularVelocity = value;
|
angularVelocity = value;
|
||||||
}
|
}
|
||||||
setLocalAngularVelocity(angularVelocity);
|
setLocalAngularVelocity(angularVelocity);
|
||||||
_flags |= Simulation::DIRTY_ANGULAR_VELOCITY;
|
markDirtyFlags(Simulation::DIRTY_ANGULAR_VELOCITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2168,8 +2168,14 @@ bool EntityItem::addAction(EntitySimulationPointer simulation, EntityDynamicPoin
|
||||||
|
|
||||||
void EntityItem::enableNoBootstrap() {
|
void EntityItem::enableNoBootstrap() {
|
||||||
if (!(bool)(_flags & Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING)) {
|
if (!(bool)(_flags & Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING)) {
|
||||||
_flags |= Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||||
_flags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
markSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
|
|
||||||
|
// NOTE: unlike disableNoBootstrap() below, we do not call simulation->changeEntity() here
|
||||||
|
// because most enableNoBootstrap() cases are already correctly handled outside this scope
|
||||||
|
// and I didn't want to add redundant work.
|
||||||
|
// TODO: cleanup Grabs & dirtySimulationFlags to be more efficient and make more sense.
|
||||||
|
|
||||||
forEachDescendant([&](SpatiallyNestablePointer child) {
|
forEachDescendant([&](SpatiallyNestablePointer child) {
|
||||||
if (child->getNestableType() == NestableType::Entity) {
|
if (child->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
||||||
|
@ -2182,13 +2188,21 @@ void EntityItem::enableNoBootstrap() {
|
||||||
|
|
||||||
void EntityItem::disableNoBootstrap() {
|
void EntityItem::disableNoBootstrap() {
|
||||||
if (!stillHasGrabActions()) {
|
if (!stillHasGrabActions()) {
|
||||||
_flags &= ~Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||||
_flags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
clearSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
|
|
||||||
|
EntityTreePointer entityTree = getTree();
|
||||||
|
assert(entityTree);
|
||||||
|
EntitySimulationPointer simulation = entityTree->getSimulation();
|
||||||
|
assert(simulation);
|
||||||
|
simulation->changeEntity(getThisPointer());
|
||||||
|
|
||||||
forEachDescendant([&](SpatiallyNestablePointer child) {
|
forEachDescendant([&](SpatiallyNestablePointer child) {
|
||||||
if (child->getNestableType() == NestableType::Entity) {
|
if (child->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
||||||
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||||
entity->clearSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
entity->clearSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
|
simulation->changeEntity(entity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2574,7 +2588,7 @@ QList<EntityDynamicPointer> EntityItem::getActionsOfType(EntityDynamicType typeT
|
||||||
void EntityItem::locationChanged(bool tellPhysics) {
|
void EntityItem::locationChanged(bool tellPhysics) {
|
||||||
requiresRecalcBoxes();
|
requiresRecalcBoxes();
|
||||||
if (tellPhysics) {
|
if (tellPhysics) {
|
||||||
_flags |= Simulation::DIRTY_TRANSFORM;
|
markDirtyFlags(Simulation::DIRTY_TRANSFORM);
|
||||||
EntityTreePointer tree = getTree();
|
EntityTreePointer tree = getTree();
|
||||||
if (tree) {
|
if (tree) {
|
||||||
tree->entityChanged(getThisPointer());
|
tree->entityChanged(getThisPointer());
|
||||||
|
@ -3445,7 +3459,7 @@ void EntityItem::addGrab(GrabPointer grab) {
|
||||||
if (useAction) {
|
if (useAction) {
|
||||||
EntityTreePointer entityTree = getTree();
|
EntityTreePointer entityTree = getTree();
|
||||||
assert(entityTree);
|
assert(entityTree);
|
||||||
EntitySimulationPointer simulation = entityTree ? entityTree->getSimulation() : nullptr;
|
EntitySimulationPointer simulation = entityTree->getSimulation();
|
||||||
assert(simulation);
|
assert(simulation);
|
||||||
|
|
||||||
auto actionFactory = DependencyManager::get<EntityDynamicFactoryInterface>();
|
auto actionFactory = DependencyManager::get<EntityDynamicFactoryInterface>();
|
||||||
|
@ -3494,7 +3508,6 @@ void EntityItem::removeGrab(GrabPointer grab) {
|
||||||
setLocalVelocity(glm::vec3(0.0f));
|
setLocalVelocity(glm::vec3(0.0f));
|
||||||
setAngularVelocity(glm::vec3(0.0f));
|
setAngularVelocity(glm::vec3(0.0f));
|
||||||
}
|
}
|
||||||
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE);
|
|
||||||
|
|
||||||
QUuid actionID = grab->getActionID();
|
QUuid actionID = grab->getActionID();
|
||||||
if (!actionID.isNull()) {
|
if (!actionID.isNull()) {
|
||||||
|
|
Loading…
Reference in a new issue