Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5000 in orxonox.OLD


Ignore:
Timestamp:
Aug 13, 2005, 9:07:56 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: smooth-rotation is better now
PNODE_MOVEMENT_ROTATE-children are correcly smooth-reparented
some other minor fixes

THIS IS 5000 :)
so
generated the endOfTheWorld-function
implemented de-generic recapitualisation Procedures
imported magnificizer
dezentralized obscurities
some other minor stuff
flush
eliminated deamons

man… i must have to much time

Location:
orxonox/trunk/src
Files:
8 edited

Legend:

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

    r4998 r5000  
    483483  parentNode->addChild(this);
    484484
    485 /* if (this->parentMode & PNODE_ROTATE_MOVEMENT)
    486   this->setRelCoor(parent->getRelDir().apply(tmpV - parent->getAbsCoor()));
    487   else*/
    488   this->setRelCoor(tmpV - parentNode->getAbsCoor());
     485 if (this->parentMode & PNODE_ROTATE_MOVEMENT)
     486   this->setRelCoor(this->parent->getAbsDir().inverse().apply(tmpV - this->parent->getAbsCoor()));
     487 else
     488   this->setRelCoor(tmpV - parentNode->getAbsCoor());
    489489
    490490  this->setRelDir(tmpQ / parentNode->getAbsDir());
     
    542542      if (unlikely(this->toDirection != NULL))
    543543      {
    544         Quaternion rotQuat = Quaternion(.1, Vector(0,1,0));// (*this->toDirection / this->relDirection);
     544        Quaternion rotQuat = (*this->toDirection / this->relDirection)*dt;
    545545//         printf("1: ");
    546546//         this->relDirection.debug();
    547547//         printf("2: ");
    548548//         this->toDirection->debug();
    549 //         printf("3: ");
    550 //         rotQuat.debug();
    551 
    552         if (true)//likely(rotQuat.len() >= .001))
     549        //printf("3: ");
     550        //rotQuat.debug2();
     551
     552        if (likely(rotQuat.getSpacialAxisAngle() >= .01))
    553553        {
    554554          this->shiftDir(rotQuat);
     
    556556        else
    557557        {
    558           delete this->toCoordinate;
    559           this->toCoordinate = NULL;
    560           PRINTF(5)("SmoothMove of %s finished\n", this->getName());
     558          delete this->toDirection;
     559          this->toDirection = NULL;
     560          PRINTF(5)("SmoothRotate of %s finished\n", this->getName());
    561561        }
    562562      }
  • orxonox/trunk/src/lib/coord/p_node.h

    r4993 r5000  
    2626
    2727// FORWARD DEFINITION \\
    28 class PNode; /* forward decleration, so that parentEntry has access to PNode */
    29 //class Quaternion;
    30 //class Vector;
    3128class TiXmlElement;
    3229template<class T> class tList;
  • orxonox/trunk/src/lib/math/vector.cc

    r4999 r5000  
    282282}
    283283
     284void Quaternion::debug2()
     285{
     286  Vector axis = this->getSpacialAxis();
     287  PRINT(0)("angle = %f, axis: ax=%f, ay=%f, az=%f\n", this->getSpacialAxisAngle(), axis.x, axis.y, axis.z );
     288}
     289
    284290/**
    285291 *  create a rotation from a vector
  • orxonox/trunk/src/lib/math/vector.h

    r4999 r5000  
    157157  inline Quaternion conjugate () const { return Quaternion(Vector(-v.x, -v.y, -v.z), this->w); };
    158158  /** @returns the norm of The Quaternion */
    159   inline float norm () const { return w*w + v.x*v.x + v.y*v.y + v.z*v.z; };
     159  inline float norm () const { return sqrt(w*w + v.x*v.x + v.y*v.y + v.z*v.z); };
    160160  /** @returns the inverted Quaterntion of this */
    161   inline Quaternion inverse () const { return conjugate() / norm(); };
     161  inline Quaternion inverse () const { return conjugate() / (w*w + v.x*v.x + v.y*v.y + v.z*v.z); };
    162162  /** @param v: the Vector  @return a new Vector representing v rotated by the Quaternion */
    163163  inline Vector apply (const Vector& v) const { return (*this * Quaternion(v, 0) * conjugate()).v; };
     
    176176
    177177  void debug();
     178  void debug2();
    178179
    179180
  • orxonox/trunk/src/world_entities/camera.cc

    r4998 r5000  
    142142    case VIEW_FRONT:
    143143      this->toFovy = 120.0;
    144 //       this->softReparent("Player");
    145 //       this->target->softReparent("Player");
    146 //       this->setRelCoorSoft(4, 0, 0);
    147 //       this->target->setRelCoorSoft(10,0,0);
    148       this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));
     144       this->softReparent("Player");
     145       this->target->softReparent("Player");
     146       this->setRelCoorSoft(4, 0, 0);
     147       this->target->setRelCoorSoft(10,0,0);
     148      //this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));
    149149      break;
    150150    case VIEW_LEFT:
  • orxonox/trunk/src/world_entities/player.cc

    r4998 r5000  
    121121void Player::init()
    122122{
    123   this->setAbsDir(0,1,0);
     123//  this->setAbsDir(0,1,0);
    124124
    125125  this->setClassID(CL_PLAYER, "Player");
  • orxonox/trunk/src/world_entities/weapons/test_gun.cc

    r4982 r5000  
    178178
    179179  pj->setParent(NullParent::getInstance());
    180 /*
    181   PNode* target = this->getWeaponManager()->getFixedTarget();
    182   if (target != NULL)
    183   {
    184     pj->setVelocity(this->getVelocity()+(target->getAbsCoor() - this->getAbsCoor())*.5);//this->getVelocity());
    185   }
    186   else*/
     180
    187181  pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*20);
    188182
     
    219213void TestGun::draw ()
    220214{
    221   this->getWeaponManager()->getFixedTarget()->debugDraw(10);
    222 
    223215  /* draw gun body */
    224216  glMatrixMode(GL_MODELVIEW);
    225217  glPushMatrix();
    226   float matrix[4][4];
    227218  glTranslatef (this->getAbsCoor ().x,
    228219                this->getAbsCoor ().y,
    229220                this->getAbsCoor ().z);
    230   this->getAbsDir ().matrix (matrix);
    231   glMultMatrixf((float*)matrix);
     221
     222  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     223  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     224
    232225  if( this->leftRight == W_RIGHT)
    233226    glScalef(1.0, 1.0, -1.0);
     
    241234                this->objectComponent1->getAbsCoor ().y,
    242235                this->objectComponent1->getAbsCoor ().z);
    243   this->objectComponent1->getAbsDir ().matrix (matrix);
    244   glMultMatrixf((float*)matrix);
     236  tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis();
     237  glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    245238  this->model->draw(0);
    246239  glPopMatrix();
  • orxonox/trunk/src/world_entities/weapons/turret.cc

    r4982 r5000  
    164164  glMatrixMode(GL_MODELVIEW);
    165165  glPushMatrix();
    166   float matrix[4][4];
    167166  glTranslatef (this->getAbsCoor ().x,
    168167                this->getAbsCoor ().y,
    169168                this->getAbsCoor ().z);
    170   this->getAbsDir ().matrix (matrix);
    171   glMultMatrixf((float*)matrix);
     169  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     170  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    172171
    173172  this->model->draw();
Note: See TracChangeset for help on using the changeset viewer.