Changeset 7048 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Feb 6, 2006, 1:46:54 PM (19 years ago)
- Location:
- trunk/src/world_entities/environments
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/environments/model_entity.cc
r6970 r7048 34 34 this->toList(OM_ENVIRON_NOTICK); 35 35 36 this->speed = NULL; 37 this->momentum = NULL; 38 36 39 if (root != NULL) 37 40 this->loadParams(root); … … 44 47 ModelEntity::~ModelEntity() 45 48 { 49 if (this->speed != NULL) 50 delete this->speed; 51 if (this->momentum) 52 delete this->momentum; 53 } 54 55 void ModelEntity::loadParams(const TiXmlElement* root) 56 { 57 WorldEntity::loadParams(root); 58 59 LoadParam(root, "speed", this, ModelEntity, setSpeed); 60 LoadParam(root, "momentum", this, ModelEntity, setMomentum); 46 61 } 47 62 48 63 64 void ModelEntity::setSpeed(float x, float y, float z) 65 { 66 if (this->speed == NULL) 67 this->speed = new Vector; 68 *this->speed = Vector(x,y,z); 69 } 70 71 void ModelEntity::setMomentum (float angle, float x, float y, float z) 72 { 73 if (this->momentum == NULL) 74 this->momentum = new Quaternion; 75 *this->momentum = Quaternion(angle, Vector(x, y, z)); 76 } 77 78 void ModelEntity::tick(float dt) 79 { 80 if (this->speed != NULL) 81 this->shiftCoor(*this->speed * dt); 82 83 if (this->momentum != NULL) 84 this->shiftDir(*this->momentum * dt); 85 } -
trunk/src/world_entities/environments/model_entity.h
r6988 r7048 20 20 virtual ~ModelEntity(); 21 21 22 virtual void loadParams(const TiXmlElement* root); 23 24 void setSpeed(float x, float y, float z); 25 void setMomentum (float angle, float x, float y, float z); 26 27 virtual void tick(float dt); 28 29 private: 30 Vector* speed; 31 Quaternion* momentum; 22 32 }; 23 33
Note: See TracChangeset
for help on using the changeset viewer.