Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2008, 11:33:58 PM (17 years ago)
Author:
rgrieder
Message:
  • Fixed issues with CollisionShape loading, handling and synchronisation.
  • Added eol-style native to PlaneCollisionShape
  • Unified treatment of configuring btCollisionShapes when parameters change
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc

    r2374 r2403  
    4444        RegisterObject(SphereCollisionShape);
    4545
    46         this->sphereShape_ = new btSphereShape(1.0f);
    47         this->collisionShape_ = this->sphereShape_;
     46        this->radius_ = 1.0f;
     47        updateSphere();
    4848
    4949        this->registerVariables();
     
    5858    void SphereCollisionShape::registerVariables()
    5959    {
    60         REGISTERDATA(this->radius_, network::direction::toclient, new network::NetworkCallback<SphereCollisionShape>(this, &SphereCollisionShape::radiusChanged));
     60        REGISTERDATA(this->radius_, network::direction::toclient, new network::NetworkCallback<SphereCollisionShape>(this, &SphereCollisionShape::updateSphere));
    6161    }
    6262
     
    6868    }
    6969
    70     void SphereCollisionShape::setRadius(float radius)
     70    void SphereCollisionShape::updateSphere()
    7171    {
    72         // TODO: Think about where this could be referenced already.
    73         this->radius_ = radius;
    74         delete this->sphereShape_;
    75         this->sphereShape_ = new btSphereShape(radius);
     72        if (this->collisionShape_)
     73            delete this->collisionShape_;
     74        this->collisionShape_ = new btSphereShape(this->radius_);
    7675    }
    7776}
Note: See TracChangeset for help on using the changeset viewer.