- Timestamp:
- Jan 11, 2015, 3:40:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc
r9667 r10189 37 37 38 38 #include "core/CoreIncludes.h" 39 #include "core/XMLPort.h"40 39 #include "tools/BulletConversions.h" 41 40 … … 48 47 Constructor. Registers and initializes the object. 49 48 */ 50 ConeCollisionShape::ConeCollisionShape(Context* context) : CollisionShape(context)49 ConeCollisionShape::ConeCollisionShape(Context* context) : AbstractRadiusHeightCollisionShape(context) 51 50 { 52 51 RegisterObject(ConeCollisionShape); 53 52 54 this->radius_ = 1.0f;55 this->height_ = 1.0f;56 53 updateShape(); 57 58 this->registerVariables();59 54 } 60 55 … … 63 58 if (this->isInitialized()) 64 59 delete this->collisionShape_; 65 }66 67 void ConeCollisionShape::registerVariables()68 {69 registerVariable(this->radius_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));70 registerVariable(this->height_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));71 }72 73 void ConeCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)74 {75 SUPER(ConeCollisionShape, XMLPort, xmlelement, mode);76 77 XMLPortParam(ConeCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);78 XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode);79 }80 81 /**82 @brief83 Is called when the scale of the ConeCollisionShape has changed.84 */85 void ConeCollisionShape::changedScale()86 {87 CollisionShape::changedScale();88 89 // Resize the internal collision shape90 // TODO: Assuming setLocalScaling works.91 //this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));92 if(!this->hasUniformScaling())93 {94 orxout(internal_error) << "ConeCollisionShape: Non-uniform scaling is not yet supported." << endl;95 return;96 }97 98 this->radius_ *= this->getScale();99 this->height_ *= this->getScale();100 this->updateShape();101 60 } 102 61 … … 109 68 btCollisionShape* ConeCollisionShape::createNewShape() const 110 69 { 111 return new btConeShape(this-> radius_, this->height_);70 return new btConeShape(this->getRadius(), this->getHeight()); 112 71 } 113 72 }
Note: See TracChangeset
for help on using the changeset viewer.