Merge pull request #6463 from sethalves/fix-observers-dont-see-equip-motion

fix bug where observers don't see a held/equipped object moving
This commit is contained in:
Andrew Meadows 2015-11-23 13:17:29 -08:00
commit 865729ef26
4 changed files with 16 additions and 0 deletions

View file

@ -327,4 +327,6 @@ void AvatarActionHold::deserialize(QByteArray serializedArguments) {
_active = true;
});
forceBodyNonStatic();
}

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

@ -246,6 +246,18 @@ void ObjectAction::activateBody() {
}
}
void ObjectAction::forceBodyNonStatic() {
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() {
if (_expires == 0) {
return false;

View file

@ -63,6 +63,7 @@ protected:
virtual glm::vec3 getAngularVelocity();
virtual void setAngularVelocity(glm::vec3 angularVelocity);
virtual void activateBody();
virtual void forceBodyNonStatic();
EntityItemWeakPointer _ownerEntity;
QString _tag;