Changeset 4990 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Aug 12, 2005, 4:54:18 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r4989 r4990 113 113 114 114 this->toPosition = NULL; 115 this->toDirection = NULL; 115 116 } 116 117 … … 187 188 188 189 *this->toPosition = relCoordSoft; 190 } 191 192 193 /** 194 * set relative coordinates 195 * @param x x-relative coordinates to its parent 196 * @param y y-relative coordinates to its parent 197 * @param z z-relative coordinates to its parent 198 \see void PNode::setRelCoor (const Vector& relCoord) 199 */ 200 void PNode::setRelCoorSoft (float x, float y, float z) 201 { 202 this->setRelCoorSoft(Vector(x, y, z)); 189 203 } 190 204 … … 277 291 } 278 292 293 294 /** 295 * sets the Relative Direction of this node to its parent in a Smoothed way 296 * @param relDirSoft the direction to iterate to smoothely. 297 */ 298 void PNode::setRelDirSoft(const Quaternion& relDirSoft) 299 { 300 if (likely(this->toDirection == NULL)) 301 this->toDirection = new Quaternion(); 302 303 *this->toDirection = relDirSoft; 304 } 305 306 /** 307 * @see void PNode::setRelDirSoft (const Quaternion& relDir) 308 * @param x the x direction 309 * @param y the y direction 310 * @param z the z direction 311 * 312 * main difference is, that here you give a directional vector, that will be translated into a Quaternion 313 */ 314 void PNode::setRelDirSoft(float x, float y, float z) 315 { 316 this->setRelDirSoft(Quaternion(Vector(x,y,z), Vector(0,1,0))); 317 } 318 319 279 320 /** 280 321 * sets the absolute direction (0,0,1) … … 418 459 } 419 460 461 /** 462 * does the reparenting in a very smooth way 463 * @param parentNode the new Node to connect this node to. 464 */ 420 465 void PNode::softReparent(PNode* parentNode) 421 466 { … … 426 471 *this->toPosition = this->getRelCoor(); 427 472 } 428 429 430 Vector tmp = this->getAbsCoor(); 473 if (likely(this->toDirection == NULL)) 474 { 475 this->toDirection = new Quaternion(); 476 *this->toDirection = this->getRelDir(); 477 } 478 479 480 Vector tmpV = this->getAbsCoor(); 481 Quaternion tmpQ = this->getAbsDir(); 431 482 432 483 parentNode->addChild(this); 433 484 434 this->setRelCoor(tmp - parentNode->getAbsCoor()); 485 this->setRelCoor(tmpV - parentNode->getAbsCoor()); 486 this->setRelDir(tmpQ - parentNode->getAbsDir()); 435 487 } 436 488 … … 511 563 PRINTF(5)("SmoothMove of %s finished\n", this->getName()); 512 564 } 565 } 566 if (unlikely(this->toDirection != NULL)) 567 { 568 Quaternion rotQuat = (*this->toDirection - this->getRelDir()) *dt; 569 570 // if (likely(rotQuat.len() >= .001)) 571 { 572 this->shiftDir(rotQuat); 573 } 574 /* else 575 { 576 delete this->toPosition; 577 this->toPosition = NULL; 578 PRINTF(5)("SmoothMove of %s finished\n", this->getName()); 579 }*/ 513 580 } 514 581 -
orxonox/trunk/src/lib/coord/p_node.h
r4987 r4990 62 62 void setRelCoor (const Vector& relCoord); 63 63 void setRelCoor (float x, float y, float z); 64 void setRelCoorSoft(const Vector& softRelCoord); 64 void setRelCoorSoft(const Vector& relCoordSoft); 65 void setRelCoorSoft(float x, float y, float z); 65 66 /** @returns the relative position */ 66 67 inline const Vector& getRelCoor () const { return this->relCoordinate; }; … … 73 74 void setRelDir (const Quaternion& relDir); 74 75 void setRelDir (float x, float y, float z); 76 void setRelDirSoft(const Quaternion& relDirSoft); 77 void setRelDirSoft(float x, float y, float z); 75 78 /** @returns the relative Direction */ 76 79 inline const Quaternion& getRelDir () const { return this->relDirection; }; … … 139 142 140 143 141 Vector* toPosition; //!< a position to wich to iterate. (This is used in conjunction with softReparent.) 144 Vector* toPosition; //!< a position to which to iterate. (This is used in conjunction with softReparent.and set*CoorSoft) 145 Quaternion* toDirection; //!< a direction to which to iterate. (This is used in conjunction with softReparent and set*DirSoft) 142 146 143 147 PNode* parent; //!< a pointer to the parent node -
orxonox/trunk/src/world_entities/player.cc
r4986 r4990 123 123 this->setClassID(CL_PLAYER, "Player"); 124 124 125 // this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);125 // this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 126 126 travelSpeed = 15.0; 127 127 velocity = new Vector();
Note: See TracChangeset
for help on using the changeset viewer.