Changeset 2403 for code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc
- Timestamp:
- Dec 10, 2008, 11:33:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc
r2374 r2403 44 44 RegisterObject(SphereCollisionShape); 45 45 46 this-> sphereShape_ = new btSphereShape(1.0f);47 this->collisionShape_ = this->sphereShape_;46 this->radius_ = 1.0f; 47 updateSphere(); 48 48 49 49 this->registerVariables(); … … 58 58 void SphereCollisionShape::registerVariables() 59 59 { 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)); 61 61 } 62 62 … … 68 68 } 69 69 70 void SphereCollisionShape:: setRadius(float radius)70 void SphereCollisionShape::updateSphere() 71 71 { 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_); 76 75 } 77 76 }
Note: See TracChangeset
for help on using the changeset viewer.