- Timestamp:
- Oct 21, 2005, 9:45:54 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r5406 r5414 415 415 this->setAbsDir(Quaternion(Vector(x,y,z), Vector(0,1,0))); 416 416 } 417 418 /** 419 * sets the absolute direction 420 * @param absDir absolute coordinates 421 */ 422 void PNode::setAbsDirSoft (const Quaternion& absDirSoft, float bias) 423 { 424 if (this->toDirection == NULL) 425 this->toDirection = new Quaternion(); 426 427 if (likely(this->parent != NULL)) 428 *this->toDirection = absDirSoft / this->parent->getAbsDir(); 429 else 430 *this->toDirection = absDirSoft; 431 432 this->bias = bias; 433 } 434 435 /** 436 * @see void PNode::setAbsDir (const Quaternion& relDir) 437 * @param x the x direction 438 * @param y the y direction 439 * @param z the z direction 440 * 441 * main difference is, that here you give a directional vector, that will be translated into a Quaternion 442 */ 443 void PNode::setAbsDirSoft (float x, float y, float z, float bias) 444 { 445 this->setAbsDirSoft(Quaternion(Vector(x,y,z), Vector(0,1,0)), bias); 446 } 447 417 448 418 449 /** -
trunk/src/lib/coord/p_node.h
r5406 r5414 83 83 void setAbsDir (const Quaternion& absDir); 84 84 void setAbsDir (float x, float y, float z); 85 void setAbsDirSoft(const Quaternion& absDirSoft, float bias = 1.0); 86 void setAbsDirSoft(float x, float y, float z, float bias = 1.0); 85 87 /** @returns the absolute Direction */ 86 88 inline const Quaternion& getAbsDir () const { return this->absDirection; }; -
trunk/src/lib/graphics/render2D/element_2d.cc
r5404 r5414 367 367 368 368 /** 369 * @param absCoordSoft set absolute coordinate 370 * @param bias how fast to iterato to the new Coordinate 371 */ 372 void Element2D::setAbsCoorSoft2D (const Vector& absCoordSoft, float bias) 373 { 374 if (this->toCoordinate == NULL) 375 this->toCoordinate = new Vector(); 376 377 if( likely(this->parentMode & E2D_PARENT_MOVEMENT)) 378 { 379 /* if you have set the absolute coordinates this overrides all other changes */ 380 if (likely(this->parent != NULL)) 381 *this->toCoordinate = absCoordSoft - parent->getAbsCoor2D (); 382 else 383 *this->toCoordinate = absCoordSoft; 384 } 385 if( this->parentMode & E2D_PARENT_ROTATE_MOVEMENT) 386 { 387 if (likely(this->parent != NULL)) 388 *this->toCoordinate = absCoordSoft - parent->getAbsCoor2D (); 389 else 390 *this->toCoordinate = absCoordSoft; 391 } 392 393 this->bias = bias; 394 } 395 396 /** 397 * @param x x-coordinate. 398 * @param y y-coordinate. 399 * @param z z-coordinate. 400 * @see void PNode::setAbsCoor (const Vector& absCoord) 401 */ 402 void Element2D::setAbsCoorSoft2D (float x, float y, float depth, float bias) 403 { 404 this->setAbsCoorSoft2D(Vector(x, y, depth), bias); 405 } 406 407 /** 369 408 * shift coordinate ralative 370 409 * @param shift shift vector … … 439 478 440 479 this->bRelDirChanged = true; 480 } 481 482 /** 483 * sets the absolute direction softly 484 * @param absDir absolute coordinates 485 */ 486 void Element2D::setAbsDirSoft2D (float absDirSoft, float bias) 487 { 488 if (this->toDirection == NULL) 489 this->toDirection = new float; 490 491 if (likely(this->parent != NULL)) 492 *this->toDirection = absDirSoft - this->parent->getAbsDir2D(); 493 else 494 *this->toDirection = absDirSoft; 495 496 this->bias = bias; 441 497 } 442 498 -
trunk/src/lib/graphics/render2D/element_2d.h
r5404 r5414 134 134 void setAbsCoor2D (float x, float y, float depth = 1.0); 135 135 void setAbsCoor2Dpx (int x, int y); 136 void setAbsCoorSoft2D (const Vector& absCoordSoft, float bias = 1.0); 137 void setAbsCoorSoft2D (float x, float y, float depth = 1.0, float bias = 1.0); 136 138 /** @returns the absolute position */ 137 139 inline const Vector& getAbsCoor2D () const { return this->absCoordinate; }; … … 148 150 inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; }; 149 151 void setAbsDir2D (float absDir); 152 void setAbsDirSoft2D (float absDirSoft, float bias = 1.0); 150 153 /** @returns the absolute Direction */ 151 154 inline float getAbsDir2D () const { return this->absDirection; }; -
trunk/src/world_entities/weapons/turret.cc
r5357 r5414 127 127 quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ; 128 128 129 this->setAbsDir (quat);129 this->setAbsDirSoft(quat, 5); 130 130 } 131 131 … … 140 140 if (target != NULL) 141 141 { 142 pj->setVelocity(this->getVelocity()+(target->getAbsCoor() - this->getAbsCoor())*.5);//this->getVelocity()); 143 pj->setAbsDir(this->getAbsDir()); 142 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 144 143 } 145 144 else
Note: See TracChangeset
for help on using the changeset viewer.