Changeset 2403 for code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/PlaneCollisionShape.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/PlaneCollisionShape.cc
- Property svn:eol-style set to native
r2374 r2403 42 42 RegisterObject(PlaneCollisionShape); 43 43 44 this->planeShape_ = new btStaticPlaneShape(btVector3(1, 1, 1), 0); 45 this->collisionShape_ = this->planeShape_; 46 this->planeNormal_ = Vector3(1, 1, 1); 47 this->planeOffset_ = 0.0f; 44 this->normal_ = Vector3(0, 1, 0); 45 this->offset_ = 0.0f; 46 updatePlane(); 47 48 this->registerVariables(); 48 49 } 49 50 … … 51 52 { 52 53 if (this->isInitialized()) 53 delete this-> planeShape_;54 delete this->collisionShape_; 54 55 } 55 56 56 57 void PlaneCollisionShape::registerVariables() 57 58 { 58 REGISTERDATA(this-> planeNormal_, network::direction::toclient, new network::NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::planeNormalChanged));59 REGISTERDATA(this-> planeOffset_, network::direction::toclient, new network::NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::planeOffsetChanged));59 REGISTERDATA(this->normal_, network::direction::toclient, new network::NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::updatePlane)); 60 REGISTERDATA(this->offset_, network::direction::toclient, new network::NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::updatePlane)); 60 61 } 61 62 … … 64 65 SUPER(PlaneCollisionShape, XMLPort, xmlelement, mode); 65 66 66 XMLPortParam(PlaneCollisionShape, " planeNormal", setNormal, getNormal, xmlelement, mode);67 XMLPortParam(PlaneCollisionShape, " planeOffset", setOffset, getOffset, xmlelement, mode);67 XMLPortParam(PlaneCollisionShape, "normal", setNormal, getNormal, xmlelement, mode); 68 XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode); 68 69 } 69 70 70 void PlaneCollisionShape:: setNormal(const Vector3& normal)71 void PlaneCollisionShape::updatePlane() 71 72 { 72 delete this->planeShape_; 73 this->planeNormal_ = normal; 74 this->planeShape_ = new btStaticPlaneShape(omni_cast<btVector3>(normal), this->planeOffset_); 75 this->collisionShape_ = this->planeShape_; 76 } 77 78 void PlaneCollisionShape::setOffset(float offset) 79 { 80 delete this->planeShape_; 81 this->planeOffset_ = offset; 82 this->planeShape_ = new btStaticPlaneShape(omni_cast<btVector3>(this->planeNormal_), offset); 83 this->collisionShape_ = this->planeShape_; 73 if (this->collisionShape_) 74 delete this->collisionShape_; 75 this->collisionShape_ = new btStaticPlaneShape(omni_cast<btVector3>(this->normal_), this->offset_); 84 76 } 85 77 }
Note: See TracChangeset
for help on using the changeset viewer.