Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5001 in orxonox.OLD


Ignore:
Timestamp:
Aug 13, 2005, 10:08:47 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: update-setRelDir works correctly now :)

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/defs/alincl.h

    r4983 r5001  
    11/*!
    2   \file alincl.h
    3   \brief This file includes al Headers.
    4 
    5   no Class is defined here, but the openAL Headers
     2 * This file includes openAL-Headers.
     3 * @file alincl.h
    64*/
    75
  • orxonox/trunk/src/lib/coord/p_node.cc

    r5000 r5001  
    337337void PNode::setAbsDir (const Quaternion& absDir)
    338338{
    339   if (this->parent)
    340     this->relDirection = absDir / parent->getAbsDir();
     339  if (likely(this->parent != NULL))
     340    this->relDirection = absDir / this->parent->getAbsDir();
    341341  else
    342     this->relDirection = absDir;
     342   this->relDirection = absDir;
    343343
    344344  this->bRelDirChanged = true;
    345 //  this->absDirection = absDir;
    346345}
    347346
     
    576575      {
    577576        /* update the current absDirection - remember * means rotation around sth.*/
    578         this->absDirection = parent->getAbsDir() * this->relDirection;
     577        this->absDirection = this->relDirection * parent->getAbsDir();;
    579578      }
    580579
  • orxonox/trunk/src/lib/math/vector.h

    r5000 r5001  
    171171  inline Vector getSpacialAxis() const { return this->v / sin(acos(w));/*sqrt(v.x*v.x + v.y*v.y + v.z+v.z);*/ };
    172172  /** @returns the rotational angle of this Quaternion around getSpacialAxis()  !! IN DEGREE !! */
    173   inline float getSpacialAxisAngle() const { return 360 / M_PI * acos(this->w); };
     173  inline float getSpacialAxisAngle() const { return 360.0 / M_PI * acos(this->w); };
    174174
    175175  static Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);
  • orxonox/trunk/src/world_entities/weapons/turret.cc

    r5000 r5001  
    116116void Turret::tick(float dt)
    117117{
     118  Quaternion quat;
    118119  Vector direction = this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();
     120
    119121  direction.normalize();
     122
    120123  if (likely (this->getParent() != NULL))
    121   {
    122     Quaternion quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
    123     this->setAbsDir(quat);
    124   }
     124    quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
    125125  else
    126   {
    127     Quaternion quat = Quaternion(direction, this->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
    128     this->setAbsDir(quat);
    129   }
     126    quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     127
     128  this->setAbsDir(quat);
    130129}
    131130
Note: See TracChangeset for help on using the changeset viewer.