mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
Changes after discussion with Brad
This commit is contained in:
parent
ebe6ce9c8d
commit
3ec73cc5e1
1 changed files with 14 additions and 4 deletions
|
@ -1095,10 +1095,20 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons
|
||||||
if ((bool)entityA && (bool)entityB) {
|
if ((bool)entityA && (bool)entityB) {
|
||||||
QUuid entityASimulatorID = entityA->getSimulatorID();
|
QUuid entityASimulatorID = entityA->getSimulatorID();
|
||||||
QUuid entityBSimulatorID = entityB->getSimulatorID();
|
QUuid entityBSimulatorID = entityB->getSimulatorID();
|
||||||
bool entityAIsStatic = !entityA->getDynamic() && !entityA->isMoving();
|
bool entityAIsDynamic = entityA->getDynamic();
|
||||||
bool entityBIsStatic = !entityB->getDynamic() && !entityB->isMoving();
|
bool entityBIsDynamic = entityB->getDynamic();
|
||||||
|
|
||||||
if (myNodeID == entityASimulatorID || (myNodeID == entityBSimulatorID && entityAIsStatic)) {
|
#ifdef WANT_DEBUG
|
||||||
|
bool bothEntitiesStatic = !entityAIsDynamic && !entityBIsDynamic;
|
||||||
|
if (bothEntitiesStatic) {
|
||||||
|
qCDebug(entities) << "A collision has occurred between two static entities!";
|
||||||
|
qCDebug(entities) << "Entity A ID:" << entityA->getID();
|
||||||
|
qCDebug(entities) << "Entity B ID:" << entityB->getID();
|
||||||
|
}
|
||||||
|
assert(!bothEntitiesStatic);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((myNodeID == entityASimulatorID && entityAIsDynamic) || (myNodeID == entityBSimulatorID && !entityAIsDynamic)) {
|
||||||
playEntityCollisionSound(entityA, collision);
|
playEntityCollisionSound(entityA, collision);
|
||||||
emit collisionWithEntity(idA, idB, collision);
|
emit collisionWithEntity(idA, idB, collision);
|
||||||
if (_entitiesScriptEngine) {
|
if (_entitiesScriptEngine) {
|
||||||
|
@ -1106,7 +1116,7 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myNodeID == entityBSimulatorID || (myNodeID == entityASimulatorID && entityBIsStatic)) {
|
if ((myNodeID == entityBSimulatorID && entityBIsDynamic) || (myNodeID == entityASimulatorID && !entityBIsDynamic)) {
|
||||||
playEntityCollisionSound(entityB, collision);
|
playEntityCollisionSound(entityB, collision);
|
||||||
// since we're swapping A and B we need to send the inverted collision
|
// since we're swapping A and B we need to send the inverted collision
|
||||||
Collision invertedCollision(collision);
|
Collision invertedCollision(collision);
|
||||||
|
|
Loading…
Reference in a new issue