put isMoving back and change all uses to isMovingRelativeToParent

This commit is contained in:
Seth Alves 2016-02-10 19:01:41 -08:00
parent 880aedd444
commit 6a646f1c24
6 changed files with 17 additions and 12 deletions

View file

@ -412,7 +412,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
}
});
bool movingOrAnimating = isMoving() || isAnimatingSomething();
bool movingOrAnimating = isMovingRelativeToParent() || isAnimatingSomething();
if ((movingOrAnimating ||
_needsInitialSimulation ||
_model->getTranslation() != getPosition() ||

View file

@ -993,6 +993,10 @@ void EntityItem::simulateKinematicMotion(float timeElapsed, bool setFlags) {
}
bool EntityItem::isMoving() const {
return hasVelocity() || hasAngularVelocity();
}
bool EntityItem::isMovingRelativeToParent() const {
return hasLocalVelocity() || hasLocalAngularVelocity();
}
@ -1558,7 +1562,7 @@ void EntityItem::computeCollisionGroupAndFinalMask(int16_t& group, int16_t& mask
} else {
if (_dynamic) {
group = BULLET_COLLISION_GROUP_DYNAMIC;
} else if (isMoving() || hasActions()) {
} else if (isMovingRelativeToParent() || hasActions()) {
group = BULLET_COLLISION_GROUP_KINEMATIC;
} else {
group = BULLET_COLLISION_GROUP_STATIC;

View file

@ -345,6 +345,7 @@ public:
void clearDirtyFlags(uint32_t mask = 0xffffffff) { _dirtyFlags &= ~mask; }
bool isMoving() const;
bool isMovingRelativeToParent() const;
bool isSimulated() const { return _simulated; }

View file

@ -70,7 +70,7 @@ void EntitySimulation::prepareEntityForDelete(EntityItemPointer entity) {
}
void EntitySimulation::addEntityInternal(EntityItemPointer entity) {
if (entity->isMoving() && !entity->getPhysicsInfo()) {
if (entity->isMovingRelativeToParent() && !entity->getPhysicsInfo()) {
QMutexLocker lock(&_mutex);
_simpleKinematicEntities.insert(entity);
}
@ -78,7 +78,7 @@ void EntitySimulation::addEntityInternal(EntityItemPointer entity) {
void EntitySimulation::changeEntityInternal(EntityItemPointer entity) {
QMutexLocker lock(&_mutex);
if (entity->isMoving() && !entity->getPhysicsInfo()) {
if (entity->isMovingRelativeToParent() && !entity->getPhysicsInfo()) {
_simpleKinematicEntities.insert(entity);
} else {
_simpleKinematicEntities.remove(entity);
@ -254,7 +254,7 @@ void EntitySimulation::moveSimpleKinematics(const quint64& now) {
SetOfEntities::iterator itemItr = _simpleKinematicEntities.begin();
while (itemItr != _simpleKinematicEntities.end()) {
EntityItemPointer entity = *itemItr;
if (entity->isMoving() && !entity->getPhysicsInfo()) {
if (entity->isMovingRelativeToParent() && !entity->getPhysicsInfo()) {
entity->simulate(now);
_entitiesToSort.insert(entity);
++itemItr;

View file

@ -158,12 +158,12 @@ PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
}
return MOTION_TYPE_DYNAMIC;
}
return (_entity->isMoving() || _entity->hasActions()) ? MOTION_TYPE_KINEMATIC : MOTION_TYPE_STATIC;
return (_entity->isMovingRelativeToParent() || _entity->hasActions()) ? MOTION_TYPE_KINEMATIC : MOTION_TYPE_STATIC;
}
bool EntityMotionState::isMoving() const {
assert(entityTreeIsLocked());
return _entity && _entity->isMoving();
return _entity && _entity->isMovingRelativeToParent();
}
// This callback is invoked by the physics simulation in two cases:
@ -555,7 +555,7 @@ uint32_t EntityMotionState::getIncomingDirtyFlags() {
}
// we add DIRTY_MOTION_TYPE if the body's motion type disagrees with entity velocity settings
int bodyFlags = _body->getCollisionFlags();
bool isMoving = _entity->isMoving();
bool isMoving = _entity->isMovingRelativeToParent();
if (((bodyFlags & btCollisionObject::CF_STATIC_OBJECT) && isMoving) ||
(bodyFlags & btCollisionObject::CF_KINEMATIC_OBJECT && !isMoving)) {
dirtyFlags |= Simulation::DIRTY_MOTION_TYPE;

View file

@ -51,7 +51,7 @@ void PhysicalEntitySimulation::addEntityInternal(EntityItemPointer entity) {
if (!motionState) {
_entitiesToAddToPhysics.insert(entity);
}
} else if (entity->isMoving()) {
} else if (entity->isMovingRelativeToParent()) {
_simpleKinematicEntities.insert(entity);
}
}
@ -98,7 +98,7 @@ void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) {
_physicalObjects.remove(motionState);
_outgoingChanges.remove(motionState);
_entitiesToRemoveFromPhysics.insert(entity);
if (entity->isMoving()) {
if (entity->isMovingRelativeToParent()) {
_simpleKinematicEntities.insert(entity);
}
} else {
@ -109,7 +109,7 @@ void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) {
// Perhaps it's shape has changed and it can now be added?
_entitiesToAddToPhysics.insert(entity);
_simpleKinematicEntities.remove(entity); // just in case it's non-physical-kinematic
} else if (entity->isMoving()) {
} else if (entity->isMovingRelativeToParent()) {
_simpleKinematicEntities.insert(entity);
} else {
_simpleKinematicEntities.remove(entity); // just in case it's non-physical-kinematic
@ -208,7 +208,7 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re
} else if (!entity->shouldBePhysical()) {
// this entity should no longer be on the internal _entitiesToAddToPhysics
entityItr = _entitiesToAddToPhysics.erase(entityItr);
if (entity->isMoving()) {
if (entity->isMovingRelativeToParent()) {
_simpleKinematicEntities.insert(entity);
}
} else if (entity->isReadyToComputeShape()) {