mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:49:27 +02:00
only do infection during collisions if one of the objects is being simulated by this interface
This commit is contained in:
parent
96a44314c9
commit
fe308c0189
4 changed files with 16 additions and 4 deletions
|
@ -112,8 +112,8 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_movingStepsWithoutSimulationOwner > 100) { // XXX maybe meters from our characterController ?
|
if (_movingStepsWithoutSimulationOwner > 100) { // XXX maybe meters from our characterController ?
|
||||||
qDebug() << "XXX XXX XXX -- claiming something I saw moving";
|
// qDebug() << "XXX XXX XXX -- claiming something I saw moving";
|
||||||
setShouldClaimSimulationOwnership(true);
|
// setShouldClaimSimulationOwnership(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
|
@ -406,6 +406,16 @@ uint32_t EntityMotionState::getAndClearIncomingDirtyFlags() const {
|
||||||
return dirtyFlags;
|
return dirtyFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
QUuid EntityMotionState::getSimulatorID() const {
|
||||||
|
if (_entity) {
|
||||||
|
return _entity->getSimulatorID();
|
||||||
|
}
|
||||||
|
return QUuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void EntityMotionState::bump() {
|
void EntityMotionState::bump() {
|
||||||
setShouldClaimSimulationOwnership(true);
|
setShouldClaimSimulationOwnership(true);
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
|
|
||||||
virtual const QUuid& getObjectID() const { return _entity->getID(); }
|
virtual const QUuid& getObjectID() const { return _entity->getID(); }
|
||||||
|
|
||||||
|
virtual QUuid getSimulatorID() const;
|
||||||
virtual void bump();
|
virtual void bump();
|
||||||
|
|
||||||
EntityItem* getEntity() const { return _entity; }
|
EntityItem* getEntity() const { return _entity; }
|
||||||
|
|
|
@ -116,6 +116,7 @@ public:
|
||||||
|
|
||||||
virtual const QUuid& getObjectID() const = 0;
|
virtual const QUuid& getObjectID() const = 0;
|
||||||
|
|
||||||
|
virtual QUuid getSimulatorID() const = 0;
|
||||||
virtual void bump() = 0;
|
virtual void bump() = 0;
|
||||||
|
|
||||||
friend class PhysicsEngine;
|
friend class PhysicsEngine;
|
||||||
|
|
|
@ -255,13 +255,13 @@ void PhysicsEngine::doOwnershipInfection(const btCollisionObject* objectA, const
|
||||||
ObjectMotionState* a = static_cast<ObjectMotionState*>(objectA->getUserPointer());
|
ObjectMotionState* a = static_cast<ObjectMotionState*>(objectA->getUserPointer());
|
||||||
ObjectMotionState* b = static_cast<ObjectMotionState*>(objectB->getUserPointer());
|
ObjectMotionState* b = static_cast<ObjectMotionState*>(objectB->getUserPointer());
|
||||||
|
|
||||||
if (b && ((a && !objectA->isStaticObject()) || (objectA == characterObject))) {
|
if (b && ((a && a->getSimulatorID() == _sessionID && !objectA->isStaticObject()) || (objectA == characterObject))) {
|
||||||
// NOTE: we might own the simulation of a kinematic object (A)
|
// NOTE: we might own the simulation of a kinematic object (A)
|
||||||
// but we don't claim ownership of kinematic objects (B) based on collisions here.
|
// but we don't claim ownership of kinematic objects (B) based on collisions here.
|
||||||
if (!objectB->isStaticOrKinematicObject()) {
|
if (!objectB->isStaticOrKinematicObject()) {
|
||||||
b->bump();
|
b->bump();
|
||||||
}
|
}
|
||||||
} else if (a && ((b && !objectB->isStaticObject()) || (objectB == characterObject))) {
|
} else if (a && ((b && b->getSimulatorID() == _sessionID && !objectB->isStaticObject()) || (objectB == characterObject))) {
|
||||||
// SIMILARLY: we might own the simulation of a kinematic object (B)
|
// SIMILARLY: we might own the simulation of a kinematic object (B)
|
||||||
// but we don't claim ownership of kinematic objects (A) based on collisions here.
|
// but we don't claim ownership of kinematic objects (A) based on collisions here.
|
||||||
if (!objectA->isStaticOrKinematicObject()) {
|
if (!objectA->isStaticOrKinematicObject()) {
|
||||||
|
|
Loading…
Reference in a new issue