Changeset 3521 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Mar 12, 2005, 8:45:59 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
r3511 r3521 22 22 23 23 #include "p_node.h" 24 24 #include "null_parent.h" 25 25 26 26 using namespace std; … … 259 259 {} 260 260 261 262 263 261 /** 264 262 \brief adds a child and makes this node to a parent … … 282 280 void PNode::addChild (PNode* pNode, parentingMode mode) 283 281 { 284 pNode->mode = mode; 285 pNode->parent = this; 286 this->children->add (pNode); 282 if( pNode->parent == NULL ) 283 { 284 pNode->mode = mode; 285 pNode->parent = this; 286 this->children->add (pNode); 287 } 288 else 289 { 290 PRINTF(1)("PNode::addChild() - this node has already been added - closed Loop MARK \n"); 291 } 287 292 } 288 293 … … 295 300 { 296 301 this->children->remove (pNode); 302 pNode->parent = NULL; 297 303 } 298 304 … … 302 308 \param parent the Parent to set 303 309 */ 310 /* 304 311 void PNode::setParent (PNode* parent) 305 312 { 306 313 parent->addChild(this); 307 314 } 315 */ 308 316 309 317 /** … … 368 376 } 369 377 else 370 this->absCoordinate = parent->getAbsCoor 378 this->absCoordinate = parent->getAbsCoor() + this->relCoordinate; /* update the current absCoordinate */ 371 379 } 372 380 } 373 381 374 if( this->mode == ROTATION &&this->mode == ALL)382 if( this->mode == ROTATION || this->mode == ALL) 375 383 { 376 384 if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 377 385 { 378 386 /* if you have set the absolute coordinates this overrides all other changes */ 379 this->relDirection = this->absDirection - parent->getAbsDir 387 this->relDirection = this->absDirection - parent->getAbsDir(); 380 388 } 381 389 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 382 390 { 383 391 /* update the current absDirection - remember * means rotation around sth.*/ 384 this->absDirection = parent->getAbsDir 392 this->absDirection = parent->getAbsDir() * this->relDirection; 385 393 } 386 394 } 387 // }388 395 PNode* pn = this->children->enumerate(); 389 396 while( pn != NULL) … … 457 464 return this->objectName; 458 465 } 466 -
orxonox/trunk/src/lib/coord/p_node.h
r3488 r3521 64 64 void addChild (PNode* pNode, parentingMode mode); 65 65 void removeChild (PNode* pNode); 66 void setParent (PNode* parent);66 //void setParent (PNode* parent); 67 67 void parentCoorChanged (); 68 68 void parentDirChanged (); … … 79 79 void debug (); 80 80 81 protected: 81 82 float timeStamp; //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated 82 83 char* objectName; //!< The name of the Object
Note: See TracChangeset
for help on using the changeset viewer.