delete moving entities that travel outside of domain

This commit is contained in:
ZappoMan 2014-08-28 21:34:12 -07:00
parent 2bcad6ab2b
commit ad9ce2edd3
3 changed files with 26 additions and 17 deletions

View file

@ -2835,7 +2835,6 @@ function handeMenuEvent(menuItem) {
}
array.push({ button: "Cancel" });
var propertyName = Window.form("Edit Properties", array);
if (Window.form("Edit Properties", array)) {
var index = 0;
if (properties.type == "Model") {

View file

@ -768,23 +768,33 @@ void EntityTree::updateMovingEntities(quint64 now, QSet<EntityItemID>& entitiesT
AACube oldCube = thisEntity->getAACube();
thisEntity->update(now);
AACube newCube = thisEntity->getAACube();
if (wantDebug) {
qDebug() << "EntityTree::update() thisEntity=" << thisEntity;
qDebug() << " oldCube=" << oldCube;
qDebug() << " newCube=" << newCube;
// check to see if this movement has sent the entity outside of the domain.
AACube domainBounds(glm::vec3(0.0f,0.0f,0.0f), 1.0f);
if (!domainBounds.touches(newCube)) {
if (wantDebug) {
qDebug() << "The entity " << thisEntity->getEntityItemID() << " moved outside of the domain. Delete it.";
}
moveOperator.addEntityToMoveList(thisEntity, oldCube, newCube);
// check to see if this entity is no longer moving
EntityItem::SimulationState newState = thisEntity->getSimulationState();
if (newState == EntityItem::Changing) {
entitiesBecomingChanging << thisEntity;
} else if (newState == EntityItem::Mortal) {
entitiesBecomingMortal << thisEntity;
} else if (newState == EntityItem::Static) {
entitiesToDelete << thisEntity->getEntityItemID();
entitiesBecomingStatic << thisEntity;
} else {
if (wantDebug) {
qDebug() << "EntityTree::update() thisEntity=" << thisEntity;
qDebug() << " oldCube=" << oldCube;
qDebug() << " newCube=" << newCube;
}
moveOperator.addEntityToMoveList(thisEntity, oldCube, newCube);
// check to see if this entity is no longer moving
EntityItem::SimulationState newState = thisEntity->getSimulationState();
if (newState == EntityItem::Changing) {
entitiesBecomingChanging << thisEntity;
} else if (newState == EntityItem::Mortal) {
entitiesBecomingMortal << thisEntity;
} else if (newState == EntityItem::Static) {
entitiesBecomingStatic << thisEntity;
}
}
}
}

View file

@ -1,6 +1,5 @@
// REQUIRED:
3) if velocity sends a model out of the domain - delete it
4) Test file save load for case where two siblings have more than MTU amount of data. I wonder if the fact that file save
doesn't include the extra exists bits will break something.
@ -248,6 +247,7 @@
// SOLVED -- 42) Crash in delete model - deleting the geometry...
// SOLVED -- 43) Moving models don't always move.. I think this relates to the render optimization...
// need to make sure we re-simulate when a model is moving...
// SOLVED -- 44) if velocity sends a model out of the domain - delete it