Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 21, 2008, 2:44:00 PM (17 years ago)
Author:
rgrieder
Message:

Resolved four issues with the collision shapes:

  • NetworkCallback will of course not call functions virtually
  • CompoundCollisionShapes with a WorldEntity parent don't have to attach themselves when synchronised
  • Just in case: When changing a CollisionShape, the old gets destroyed AFTER everything has been updated
  • CompoundCollisionShapes with a WorldEntity parent now update both the WE and the CompoundCollisionShape when something changes

Other changes

  • Also replaced some redundant code while at it (updating the shapes was done individually)
  • Like in WE, the CompoundCollisionShape deletes all its children when being destroyed itself. This requires in WE that the children get detached before the CompoundCollisionShape gets deleted.
File:
1 edited

Legend:

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

    r2486 r2514  
    4646        this->radius_ = 1.0f;
    4747        this->height_ = 1.0f;
    48         updateCone();
     48        updateShape();
    4949
    5050        this->registerVariables();
     
    5959    void ConeCollisionShape::registerVariables()
    6060    {
    61         registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<ConeCollisionShape>(this, &ConeCollisionShape::updateCone));
    62         registerVariable(this->height_, variableDirection::toclient, new NetworkCallback<ConeCollisionShape>(this, &ConeCollisionShape::updateCone));
     61        registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
     62        registerVariable(this->height_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
    6363    }
    6464
     
    7171    }
    7272
    73     void ConeCollisionShape::updateCone()
     73    btCollisionShape* ConeCollisionShape::createNewShape() const
    7474    {
    75         if (this->collisionShape_)
    76             delete this->collisionShape_;
    77         this->collisionShape_ = new btConeShape(this->radius_, this->height_);
    78         this->updateParent();
     75        return  new btConeShape(this->radius_, this->height_);
    7976    }
    8077}
Note: See TracChangeset for help on using the changeset viewer.