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/SphereCollisionShape.cc

    r2459 r2514  
    4545
    4646        this->radius_ = 1.0f;
    47         updateSphere();
     47        updateShape();
    4848
    4949        this->registerVariables();
     
    5858    void SphereCollisionShape::registerVariables()
    5959    {
    60         registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<SphereCollisionShape>(this, &SphereCollisionShape::updateSphere));
     60        registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
    6161    }
    6262
     
    6868    }
    6969
    70     void SphereCollisionShape::updateSphere()
     70    btCollisionShape* SphereCollisionShape::createNewShape() const
    7171    {
    72         if (this->collisionShape_)
    73             delete this->collisionShape_;
    74         // When we recreate the shape, we have to inform the parent about this to update the shape
    75         this->collisionShape_ = new btSphereShape(this->radius_);
    76         this->updateParent();
     72        return new btSphereShape(this->radius_);
    7773    }
    7874}
Note: See TracChangeset for help on using the changeset viewer.