Changeset 4145 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- May 10, 2005, 4:54:00 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r3966 r4145 99 99 this->parent = parent; 100 100 this->objectName = NULL; 101 this->time = 1.0; /* set time to 1 to make divisions by zero impossible */102 101 } 103 102 … … 281 280 } 282 281 283 284 285 /**286 \brief this calculates the current movement speed of the node287 */288 float PNode::getSpeed() const289 {290 return (this->absCoordinate - this->lastAbsCoordinate).len() / this->time;291 }292 293 /**294 \returns the Velocity of the PNode295 */296 Vector PNode::getVelocity() const297 {298 return (this->absCoordinate - this->lastAbsCoordinate) / this->time;299 }300 301 282 /** 302 283 \brief adds a child and makes this node to a parent … … 424 405 { 425 406 this->lastAbsCoordinate = this->absCoordinate; 426 this->time = dt; 407 427 408 PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 428 409 … … 499 480 delete iterator; 500 481 482 this->velocity = (this->absCoordinate - this->lastAbsCoordinate) / dt; 501 483 this->timeStamp = timeStamp; 502 484 this->bRelCoorChanged = false; -
orxonox/trunk/src/lib/coord/p_node.h
r3966 r4145 69 69 void shiftDir (const Quaternion& shift); 70 70 71 float getSpeed() const; 72 Vector getVelocity() const; 71 /** \returns the Speed of the Node */ 72 inline float getSpeed() const {return this->velocity.len()/1000;} //! \FIX THIS SHOULD NOT BE /1000 73 /** \returns the Velocity of the Node */ 74 inline const Vector& getVelocity() const {return this->velocity;} 73 75 74 76 void addChild (PNode* pNode, int parentingMode = DEFAULT_MODE); … … 110 112 void init(PNode* parent); 111 113 114 Vector velocity; //!< Saves the velocity. 112 115 Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 113 Vector diffCoordinate; //!< this is stored here for performance reasons, difference to the last vector114 float time; //!< time since last update115 116 }; 116 117
Note: See TracChangeset
for help on using the changeset viewer.