if an entity with an action has a motion-type of static, flag it so it gets updated in bullet

This commit is contained in:
Seth Alves 2015-11-23 10:03:35 -08:00
parent eecb5b91b2
commit 6f19093cb9
2 changed files with 10 additions and 0 deletions

View file

@ -398,6 +398,7 @@ public:
void getAllTerseUpdateProperties(EntityItemProperties& properties) const;
void flagForOwnership() { _dirtyFlags |= Simulation::DIRTY_SIMULATOR_OWNERSHIP; }
void flagForMotionStateChange() { _dirtyFlags |= Simulation::DIRTY_MOTION_TYPE; }
bool addAction(EntitySimulation* simulation, EntityActionPointer action);
bool updateAction(EntitySimulation* simulation, const QUuid& actionID, const QVariantMap& arguments);

View file

@ -244,6 +244,15 @@ void ObjectAction::activateBody() {
if (rigidBody) {
rigidBody->activate();
}
auto ownerEntity = _ownerEntity.lock();
if (!ownerEntity) {
return;
}
void* physicsInfo = ownerEntity->getPhysicsInfo();
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(physicsInfo);
if (motionState && motionState->getMotionType() == MOTION_TYPE_STATIC) {
ownerEntity->flagForMotionStateChange();
}
}
bool ObjectAction::lifetimeIsOver() {