mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 16:18:03 +02:00
put isMoving back and change all uses to isMovingRelativeToParent
This commit is contained in:
parent
880aedd444
commit
6a646f1c24
6 changed files with 17 additions and 12 deletions
|
@ -412,7 +412,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bool movingOrAnimating = isMoving() || isAnimatingSomething();
|
bool movingOrAnimating = isMovingRelativeToParent() || isAnimatingSomething();
|
||||||
if ((movingOrAnimating ||
|
if ((movingOrAnimating ||
|
||||||
_needsInitialSimulation ||
|
_needsInitialSimulation ||
|
||||||
_model->getTranslation() != getPosition() ||
|
_model->getTranslation() != getPosition() ||
|
||||||
|
|
|
@ -993,6 +993,10 @@ void EntityItem::simulateKinematicMotion(float timeElapsed, bool setFlags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityItem::isMoving() const {
|
bool EntityItem::isMoving() const {
|
||||||
|
return hasVelocity() || hasAngularVelocity();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EntityItem::isMovingRelativeToParent() const {
|
||||||
return hasLocalVelocity() || hasLocalAngularVelocity();
|
return hasLocalVelocity() || hasLocalAngularVelocity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1558,7 +1562,7 @@ void EntityItem::computeCollisionGroupAndFinalMask(int16_t& group, int16_t& mask
|
||||||
} else {
|
} else {
|
||||||
if (_dynamic) {
|
if (_dynamic) {
|
||||||
group = BULLET_COLLISION_GROUP_DYNAMIC;
|
group = BULLET_COLLISION_GROUP_DYNAMIC;
|
||||||
} else if (isMoving() || hasActions()) {
|
} else if (isMovingRelativeToParent() || hasActions()) {
|
||||||
group = BULLET_COLLISION_GROUP_KINEMATIC;
|
group = BULLET_COLLISION_GROUP_KINEMATIC;
|
||||||
} else {
|
} else {
|
||||||
group = BULLET_COLLISION_GROUP_STATIC;
|
group = BULLET_COLLISION_GROUP_STATIC;
|
||||||
|
|
|
@ -345,6 +345,7 @@ public:
|
||||||
void clearDirtyFlags(uint32_t mask = 0xffffffff) { _dirtyFlags &= ~mask; }
|
void clearDirtyFlags(uint32_t mask = 0xffffffff) { _dirtyFlags &= ~mask; }
|
||||||
|
|
||||||
bool isMoving() const;
|
bool isMoving() const;
|
||||||
|
bool isMovingRelativeToParent() const;
|
||||||
|
|
||||||
bool isSimulated() const { return _simulated; }
|
bool isSimulated() const { return _simulated; }
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ void EntitySimulation::prepareEntityForDelete(EntityItemPointer entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntitySimulation::addEntityInternal(EntityItemPointer entity) {
|
void EntitySimulation::addEntityInternal(EntityItemPointer entity) {
|
||||||
if (entity->isMoving() && !entity->getPhysicsInfo()) {
|
if (entity->isMovingRelativeToParent() && !entity->getPhysicsInfo()) {
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
_simpleKinematicEntities.insert(entity);
|
_simpleKinematicEntities.insert(entity);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ void EntitySimulation::addEntityInternal(EntityItemPointer entity) {
|
||||||
|
|
||||||
void EntitySimulation::changeEntityInternal(EntityItemPointer entity) {
|
void EntitySimulation::changeEntityInternal(EntityItemPointer entity) {
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
if (entity->isMoving() && !entity->getPhysicsInfo()) {
|
if (entity->isMovingRelativeToParent() && !entity->getPhysicsInfo()) {
|
||||||
_simpleKinematicEntities.insert(entity);
|
_simpleKinematicEntities.insert(entity);
|
||||||
} else {
|
} else {
|
||||||
_simpleKinematicEntities.remove(entity);
|
_simpleKinematicEntities.remove(entity);
|
||||||
|
@ -254,7 +254,7 @@ void EntitySimulation::moveSimpleKinematics(const quint64& now) {
|
||||||
SetOfEntities::iterator itemItr = _simpleKinematicEntities.begin();
|
SetOfEntities::iterator itemItr = _simpleKinematicEntities.begin();
|
||||||
while (itemItr != _simpleKinematicEntities.end()) {
|
while (itemItr != _simpleKinematicEntities.end()) {
|
||||||
EntityItemPointer entity = *itemItr;
|
EntityItemPointer entity = *itemItr;
|
||||||
if (entity->isMoving() && !entity->getPhysicsInfo()) {
|
if (entity->isMovingRelativeToParent() && !entity->getPhysicsInfo()) {
|
||||||
entity->simulate(now);
|
entity->simulate(now);
|
||||||
_entitiesToSort.insert(entity);
|
_entitiesToSort.insert(entity);
|
||||||
++itemItr;
|
++itemItr;
|
||||||
|
|
|
@ -158,12 +158,12 @@ PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
|
||||||
}
|
}
|
||||||
return MOTION_TYPE_DYNAMIC;
|
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 {
|
bool EntityMotionState::isMoving() const {
|
||||||
assert(entityTreeIsLocked());
|
assert(entityTreeIsLocked());
|
||||||
return _entity && _entity->isMoving();
|
return _entity && _entity->isMovingRelativeToParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This callback is invoked by the physics simulation in two cases:
|
// 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
|
// we add DIRTY_MOTION_TYPE if the body's motion type disagrees with entity velocity settings
|
||||||
int bodyFlags = _body->getCollisionFlags();
|
int bodyFlags = _body->getCollisionFlags();
|
||||||
bool isMoving = _entity->isMoving();
|
bool isMoving = _entity->isMovingRelativeToParent();
|
||||||
if (((bodyFlags & btCollisionObject::CF_STATIC_OBJECT) && isMoving) ||
|
if (((bodyFlags & btCollisionObject::CF_STATIC_OBJECT) && isMoving) ||
|
||||||
(bodyFlags & btCollisionObject::CF_KINEMATIC_OBJECT && !isMoving)) {
|
(bodyFlags & btCollisionObject::CF_KINEMATIC_OBJECT && !isMoving)) {
|
||||||
dirtyFlags |= Simulation::DIRTY_MOTION_TYPE;
|
dirtyFlags |= Simulation::DIRTY_MOTION_TYPE;
|
||||||
|
|
|
@ -51,7 +51,7 @@ void PhysicalEntitySimulation::addEntityInternal(EntityItemPointer entity) {
|
||||||
if (!motionState) {
|
if (!motionState) {
|
||||||
_entitiesToAddToPhysics.insert(entity);
|
_entitiesToAddToPhysics.insert(entity);
|
||||||
}
|
}
|
||||||
} else if (entity->isMoving()) {
|
} else if (entity->isMovingRelativeToParent()) {
|
||||||
_simpleKinematicEntities.insert(entity);
|
_simpleKinematicEntities.insert(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) {
|
||||||
_physicalObjects.remove(motionState);
|
_physicalObjects.remove(motionState);
|
||||||
_outgoingChanges.remove(motionState);
|
_outgoingChanges.remove(motionState);
|
||||||
_entitiesToRemoveFromPhysics.insert(entity);
|
_entitiesToRemoveFromPhysics.insert(entity);
|
||||||
if (entity->isMoving()) {
|
if (entity->isMovingRelativeToParent()) {
|
||||||
_simpleKinematicEntities.insert(entity);
|
_simpleKinematicEntities.insert(entity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -109,7 +109,7 @@ void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) {
|
||||||
// Perhaps it's shape has changed and it can now be added?
|
// Perhaps it's shape has changed and it can now be added?
|
||||||
_entitiesToAddToPhysics.insert(entity);
|
_entitiesToAddToPhysics.insert(entity);
|
||||||
_simpleKinematicEntities.remove(entity); // just in case it's non-physical-kinematic
|
_simpleKinematicEntities.remove(entity); // just in case it's non-physical-kinematic
|
||||||
} else if (entity->isMoving()) {
|
} else if (entity->isMovingRelativeToParent()) {
|
||||||
_simpleKinematicEntities.insert(entity);
|
_simpleKinematicEntities.insert(entity);
|
||||||
} else {
|
} else {
|
||||||
_simpleKinematicEntities.remove(entity); // just in case it's non-physical-kinematic
|
_simpleKinematicEntities.remove(entity); // just in case it's non-physical-kinematic
|
||||||
|
@ -208,7 +208,7 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re
|
||||||
} else if (!entity->shouldBePhysical()) {
|
} else if (!entity->shouldBePhysical()) {
|
||||||
// this entity should no longer be on the internal _entitiesToAddToPhysics
|
// this entity should no longer be on the internal _entitiesToAddToPhysics
|
||||||
entityItr = _entitiesToAddToPhysics.erase(entityItr);
|
entityItr = _entitiesToAddToPhysics.erase(entityItr);
|
||||||
if (entity->isMoving()) {
|
if (entity->isMovingRelativeToParent()) {
|
||||||
_simpleKinematicEntities.insert(entity);
|
_simpleKinematicEntities.insert(entity);
|
||||||
}
|
}
|
||||||
} else if (entity->isReadyToComputeShape()) {
|
} else if (entity->isReadyToComputeShape()) {
|
||||||
|
|
Loading…
Reference in a new issue