Merge pull request #15651 from AndrewMeadows/fix-crash-bugz414

BUGZ-414: crash fix and don't add local entities to physics simulation
This commit is contained in:
Brad Hefta-Gaub 2019-05-30 11:35:04 -07:00 committed by GitHub
commit fda9aa00da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -744,7 +744,7 @@ bool RenderableModelEntityItem::shouldBePhysical() const {
return false;
}
}
return !isDead() && shapeType != SHAPE_TYPE_NONE && QUrl(_modelURL).isValid();
return !isDead() && shapeType != SHAPE_TYPE_NONE && !isLocalEntity() && QUrl(_modelURL).isValid();
}
int RenderableModelEntityItem::getJointParent(int index) const {

View file

@ -324,7 +324,7 @@ public:
bool getDynamic() const;
void setDynamic(bool value);
virtual bool shouldBePhysical() const { return !isDead() && getShapeType() != SHAPE_TYPE_NONE; }
virtual bool shouldBePhysical() const { return !isDead() && getShapeType() != SHAPE_TYPE_NONE && !isLocalEntity(); }
bool isVisuallyReady() const { return _visuallyReady; }
bool getLocked() const;

View file

@ -460,6 +460,8 @@ void PhysicalEntitySimulation::buildPhysicsTransaction(PhysicsEngine::Transactio
void PhysicalEntitySimulation::handleProcessedPhysicsTransaction(PhysicsEngine::Transaction& transaction) {
// things on objectsToRemove are ready for delete
for (auto object : transaction.objectsToRemove) {
EntityMotionState* entityState = static_cast<EntityMotionState*>(object);
removeOwnershipData(entityState);
_physicalObjects.remove(object);
delete object;
}