Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 21, 2008, 2:44:00 PM (15 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/PlaneCollisionShape.cc

    r2459 r2514  
    4646        this->normal_ = Vector3(0, 1, 0);
    4747        this->offset_ = 0.0f;
    48         updatePlane();
     48        updateShape();
    4949
    5050        this->registerVariables();
     
    5959    void PlaneCollisionShape::registerVariables()
    6060    {
    61         registerVariable(this->normal_, variableDirection::toclient, new NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::updatePlane));
    62         registerVariable(this->offset_, variableDirection::toclient, new NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::updatePlane));
     61        registerVariable(this->normal_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
     62        registerVariable(this->offset_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
    6363    }
    6464
     
    7171    }
    7272
    73     void PlaneCollisionShape::updatePlane()
     73    btCollisionShape* PlaneCollisionShape::createNewShape() const
    7474    {
    75         if (this->collisionShape_)
    76             delete this->collisionShape_;
    77         this->collisionShape_ = new btStaticPlaneShape(omni_cast<btVector3>(this->normal_), this->offset_);
    78         this->updateParent();
     75        return new btStaticPlaneShape(omni_cast<btVector3>(this->normal_), this->offset_);
    7976    }
    8077}
Note: See TracChangeset for help on using the changeset viewer.