when removing something from bullet, attempt to wake up anything that was touching it

This commit is contained in:
Seth Alves 2015-04-22 16:05:31 -07:00
parent 07a848c9ce
commit 96b4517e6e
5 changed files with 9 additions and 8 deletions

View file

@ -61,8 +61,6 @@ public:
void clearEntities();
virtual void bump(EntityItem* bumpEntity) {}
EntityTree* getEntityTree() { return _entityTree; }
signals:

View file

@ -269,9 +269,6 @@ void EntityTree::deleteEntity(const EntityItemID& entityID, bool force, bool ign
return;
}
// in case something is resting on top of this, give it a bump in the simulation.
_simulation->bump(existingEntity);
if (existingEntity->getLocked() && !force) {
if (!ignoreWarnings) {
qCDebug(entities) << "ERROR! EntityTree::deleteEntity() trying to delete locked entity. entityID=" << entityID;

View file

@ -328,8 +328,6 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
qCDebug(physics) << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";
#endif
qDebug() << "sending";
entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
} else {
#ifdef WANT_DEBUG

View file

@ -386,9 +386,15 @@ void PhysicsEngine::bump(EntityItem* bumpEntity) {
if (entityA && entityB) {
if (entityA == bumpEntity) {
entityB->setShouldClaimSimulationOwnership(true);
if (!objectB->isActive()) {
objectB->setActivationState(ACTIVE_TAG);
}
}
if (entityB == bumpEntity) {
entityA->setShouldClaimSimulationOwnership(true);
if (!objectA->isActive()) {
objectA->setActivationState(ACTIVE_TAG);
}
}
}
}
@ -564,6 +570,8 @@ void PhysicsEngine::addObject(const ShapeInfo& shapeInfo, btCollisionShape* shap
void PhysicsEngine::removeObjectFromBullet(ObjectMotionState* motionState) {
assert(motionState);
EntityItem* entity = static_cast<EntityMotionState*>(motionState)->getEntity();
bump(entity);
btRigidBody* body = motionState->getRigidBody();
if (body) {
const btCollisionShape* shape = body->getCollisionShape();

View file

@ -68,7 +68,6 @@ public:
void stepSimulation();
void stepNonPhysicalKinematics(const quint64& now);
virtual void bump(EntityItem* bumpEntity);
void computeCollisionEvents();
void dumpStatsIfNecessary();
@ -99,6 +98,7 @@ private:
// return 'true' of update was successful
bool updateObjectHard(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags);
void updateObjectEasy(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags);
void bump(EntityItem* bumpEntity);
btClock _clock;
btDefaultCollisionConfiguration* _collisionConfig = NULL;