Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 15, 2008, 7:57:48 PM (15 years ago)
Author:
rgrieder
Message:

Resolved the issue with the collision shape synchronisation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/objects/collisionshapes/CompoundCollisionShape.cc

    r2463 r2469  
    4747
    4848        this->compoundShape_  = new btCompoundShape();
     49        this->worldEntityParent_ = 0;
    4950    }
    5051
     
    6667    }
    6768
     69    void CompoundCollisionShape::setWorldEntityParent(WorldEntity* parent)
     70    {
     71        // suppress synchronisation
     72        this->setObjectMode(0x0);
     73
     74        this->worldEntityParent_ = parent;
     75    }
     76
    6877    void CompoundCollisionShape::addChildShape(CollisionShape* shape)
    6978    {
     
    8796
    8897        // network synchro
    89         shape->setParent(this, this->getObjectID());
     98        if (this->worldEntityParent_)
     99        {
     100            // This compound collision shape belongs to a WE and doesn't get synchronised
     101            // So set our parent to be the WE
     102            shape->setParent(this, this->worldEntityParent_->getObjectID());
     103        }
     104        else
     105            shape->setParent(this, this->getObjectID());
    90106    }
    91107
     
    176192        if (this->parent_)
    177193            this->parent_->updateChildShape(this);
    178         else
    179         {
    180             // We can do this, because the CompoundCollisionShape of a WorldEntity always belongs to it,
    181             // as long as its lifetime.
    182             WorldEntity* parent = dynamic_cast<WorldEntity*>(this->getCreator());
    183             if (parent)
    184                 parent->notifyCollisionShapeChanged();
    185         }
     194        else if (this->worldEntityParent_)
     195            this->worldEntityParent_->notifyCollisionShapeChanged();
    186196    }
    187197
Note: See TracChangeset for help on using the changeset viewer.