mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
clear incoming flags after adding an entity to simulation. If an entity has a shape-type of none, don't keep asking it for a shape
This commit is contained in:
parent
7a5fe8a34e
commit
129a3a82da
3 changed files with 5 additions and 1 deletions
|
@ -158,6 +158,7 @@ void ObjectMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine*
|
||||||
computeObjectShapeInfo(shapeInfo);
|
computeObjectShapeInfo(shapeInfo);
|
||||||
btCollisionShape* newShape = getShapeManager()->getShape(shapeInfo);
|
btCollisionShape* newShape = getShapeManager()->getShape(shapeInfo);
|
||||||
if (!newShape) {
|
if (!newShape) {
|
||||||
|
qCDebug(physics) << "Warning: failed to generate new shape!";
|
||||||
// failed to generate new shape! --> keep old shape and remove shape-change flag
|
// failed to generate new shape! --> keep old shape and remove shape-change flag
|
||||||
flags &= ~EntityItem::DIRTY_SHAPE;
|
flags &= ~EntityItem::DIRTY_SHAPE;
|
||||||
// TODO: force this object out of PhysicsEngine rather than just use the old shape
|
// TODO: force this object out of PhysicsEngine rather than just use the old shape
|
||||||
|
|
|
@ -153,7 +153,7 @@ VectorOfMotionStates& PhysicalEntitySimulation::getObjectsToAdd() {
|
||||||
while (entityItr != _pendingAdds.end()) {
|
while (entityItr != _pendingAdds.end()) {
|
||||||
EntityItem* entity = *entityItr;
|
EntityItem* entity = *entityItr;
|
||||||
assert(!entity->getPhysicsInfo());
|
assert(!entity->getPhysicsInfo());
|
||||||
if (entity->getIgnoreForCollisions()) {
|
if (entity->getShapeType() == SHAPE_TYPE_NONE || entity->getIgnoreForCollisions()) {
|
||||||
// this entity should no longer be on the internal _pendingAdds
|
// this entity should no longer be on the internal _pendingAdds
|
||||||
entityItr = _pendingAdds.erase(entityItr);
|
entityItr = _pendingAdds.erase(entityItr);
|
||||||
} else if (entity->isReadyToComputeShape()) {
|
} else if (entity->isReadyToComputeShape()) {
|
||||||
|
@ -168,6 +168,7 @@ VectorOfMotionStates& PhysicalEntitySimulation::getObjectsToAdd() {
|
||||||
_tempVector.push_back(motionState);
|
_tempVector.push_back(motionState);
|
||||||
entityItr = _pendingAdds.erase(entityItr);
|
entityItr = _pendingAdds.erase(entityItr);
|
||||||
} else {
|
} else {
|
||||||
|
qDebug() << "Warning! Failed to generate new shape for entity." << entity->getName();
|
||||||
++entityItr;
|
++entityItr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -126,6 +126,8 @@ void PhysicsEngine::addObject(ObjectMotionState* motionState) {
|
||||||
motionState->updateBodyMaterialProperties();
|
motionState->updateBodyMaterialProperties();
|
||||||
|
|
||||||
_dynamicsWorld->addRigidBody(body);
|
_dynamicsWorld->addRigidBody(body);
|
||||||
|
|
||||||
|
motionState->getAndClearIncomingDirtyFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsEngine::removeObject(ObjectMotionState* object) {
|
void PhysicsEngine::removeObject(ObjectMotionState* object) {
|
||||||
|
|
Loading…
Reference in a new issue