Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4996 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Aug 13, 2005, 2:21:18 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: reparenting now also works for Dir - optimizing

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/p_node.cc

    r4995 r4996  
    331331 *  sets the absolute direction (0,0,1)
    332332 * @param absDir absolute coordinates
    333 
    334    it is very importand, that you use this function, if you want to update the
    335    absDirection. If you don't use this, the PNode won't recognize, that something
    336    has changed and won't update the children Nodes.
    337333 *
    338  * FIXME ERROR HERE THIS IS IMPLEMENTED FALSELY
    339  * @todo FIXME
     334 * it is very importand, that you use this function, if you want to update the
     335 * absDirection. If you don't use this, the PNode won't recognize, that something
     336 * has changed and won't update the children Nodes.
    340337*/
    341338void PNode::setAbsDir (const Quaternion& absDir)
    342339{
    343 //  if (this->parent)
    344     this->relDirection = absDir;// - parent->getAbsDir();
    345 //  else
    346 //    this->relDirection = absDir;
     340  if (this->parent)
     341    this->relDirection = absDir * parent->getAbsDir().inverse();
     342  else
     343    this->relDirection = absDir;
    347344
    348345  this->bRelDirChanged = true;
     
    492489  this->setRelCoor(tmpV - parentNode->getAbsCoor());
    493490
    494   this->setRelDir(tmpQ - parentNode->getAbsDir());
     491  this->setRelDir(tmpQ * parentNode->getAbsDir().inverse());
    495492}
    496493
     
    546543      if (unlikely(this->toDirection != NULL))
    547544      {
    548         Quaternion rotQuat = (*this->toDirection - this->getRelDir()) *dt*bias;
    549 
     545        Quaternion rotQuat = (*this->toDirection * this->getRelDir().inverse()) *dt*bias;
    550546//        if (likely(rotQuat.len() >= .001))
    551547        {
     
    630626  else
    631627    PRINT(0)(" -");
    632   PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f) - %s\n",
     628  PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f), direction(%0.2f, %0.2f, %0.2f) - %s\n",
    633629           this->getClassName(),
    634630           this->getName(),
     
    639635           this->relCoordinate.y,
    640636           this->relCoordinate.z,
     637           this->getAbsDirV().x,
     638           this->getAbsDirV().y,
     639           this->getAbsDirV().z,
    641640           this->parentingModeToChar(parentMode));
    642641  if (depth >= 2 || depth == 0)
  • orxonox/trunk/src/world_entities/camera.cc

    r4994 r4996  
    142142    case VIEW_FRONT:
    143143      this->toFovy = 120.0;
    144      // this->softReparent("Player");
     144      this->softReparent("Player");
    145145      this->target->softReparent("Player");
    146146      this->setRelCoorSoft(4, 0, 0);
     
    205205  Vector cameraPosition = this->getAbsCoor();
    206206  Vector targetPosition = this->target->getAbsCoor();
    207   Vector up = Vector(0, 1, 0);
    208   up = this->getAbsDir().apply(up);
     207  Vector up = this->getAbsDirV();
    209208
    210209  // Setting the Camera Eye, lookAt and up Vectors
Note: See TracChangeset for help on using the changeset viewer.