Changeset 3644 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Mar 23, 2005, 2:32:06 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/coord
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/null_parent.cc
r3608 r3644 77 77 worry, normaly... 78 78 */ 79 void NullParent::update ( )79 void NullParent::update (float dt) 80 80 { 81 81 … … 92 92 if( this->bRelDirChanged || this->bAbsDirChanged) 93 93 pn->parentDirChanged (); 94 pn->update ( );94 pn->update (dt); 95 95 pn = this->children->nextElement (); 96 96 } -
orxonox/trunk/src/lib/coord/null_parent.h
r3607 r3644 19 19 20 20 21 virtual void update ( );22 21 virtual void update (float dt); 22 23 23 private: 24 24 NullParent (); -
orxonox/trunk/src/lib/coord/p_node.cc
r3617 r3644 115 115 this->absDirection = new Quaternion(); 116 116 this->relDirection = new Quaternion(); 117 this->lastAbsCoordinate = new Vector(); 117 118 } 118 119 … … 297 298 {} 298 299 300 301 /** 302 \brief this calculates the current movement speed of the node 303 */ 304 float PNode::getSpeed() 305 { 306 if(this->time == 0) 307 return 0; 308 Vector* diff = new Vector(); 309 *diff = *this->absCoordinate - *this->lastAbsCoordinate; 310 float x = diff->len(); 311 return x / this->time; 312 } 313 314 299 315 /** 300 316 \brief adds a child and makes this node to a parent … … 422 438 worry, normaly... 423 439 */ 424 void PNode::update () 425 { 440 void PNode::update (float dt) 441 { 442 this->time = dt; 426 443 PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z); 427 444 // printf("%s", this->objectName); … … 486 503 pn->parentDirChanged (); 487 504 488 pn->update( );505 pn->update(dt); 489 506 pn = this->children->nextElement(); 490 507 } -
orxonox/trunk/src/lib/coord/p_node.h
r3608 r3644 72 72 void shiftDir (Quaternion* shift); 73 73 74 float getSpeed(); 75 74 76 void addChild (PNode* pNode); 75 77 void addChild (PNode* pNode, int parentingMode); … … 84 86 int getMode(); 85 87 86 virtual void update ( );88 virtual void update (float dt); 87 89 void processTick (float dt); 88 90 … … 92 94 93 95 void debug (); 94 95 private:96 void init(PNode* parent);97 96 98 97 protected: … … 111 110 int mode; //!< the mode of the binding 112 111 112 private: 113 void init(PNode* parent); 114 115 Vector* lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 116 float time; //!< time since last update 113 117 }; 114 118
Note: See TracChangeset
for help on using the changeset viewer.