Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4855


Ignore:
Timestamp:
Jun 4, 2007, 12:57:01 AM (17 years ago)
Author:
landauf
Message:
 
Location:
data/contentcreation/pps/FabianLandau/mover/environments
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • data/contentcreation/pps/FabianLandau/mover/environments/mover.cc

    r4844 r4855  
    5656   
    5757    this->originCoor = Vector(0, 0, 0);
    58     this->originDir = Quaternion(0, Vector(0, 0, 0));
     58    this->originDir = Vector(0, 0, 0);
    5959
    6060    this->soundSource_starting.setSourceNode(this);
     
    6969       
    7070    this->originCoor = this->getAbsCoor();
    71     this->originDir = this->getAbsDir();
     71    this->originDir = this->getAbsDir().getRotation();
    7272
    7373    PRINTF(0)("1_3\n");
     
    291291    if (this->stations)
    292292    {
    293         this->shiftCoor(this->stations->getVelocity(this->station) * dt);
    294         this->setAbsDir(this->originDir * (this->stations->getRotation(this->station) * this->time));
     293        this->setAbsCoor(this->originCoor + this->stations->getVelocity(this->station) * this->time);
     294        this->setAbsDir(VtoQ(this->originDir + this->stations->getRotation(this->station) * this->time));
    295295    }
    296296   
     
    304304            this->time = this->stations->getMovingTime(this->station) - this->time;
    305305            this->originCoor = this->originCoor - this->stations->getRelTargetCoor(this->station);
    306             this->originDir = this->originDir / this->stations->getRelTargetDir(this->station);
     306            this->originDir = this->originDir - this->stations->getRelTargetDir(this->station);
    307307        }
    308308    }
    309309
    310     if (/*this->reachedStationsTarget(dt) || */(this->stations && (this->time >= 1.1 * this->stations->getMovingTime(this->station))))
     310    if (/*this->reachedStationsTarget(dt) || */(this->stations && (this->time >= 1.0 * this->stations->getMovingTime(this->station))))
    311311//    if (this->stations && (this->time >= this->stations->getMovingTime(this->station)))
    312312    {
    313313        this->setAbsCoor(this->originCoor + this->stations->getRelTargetCoor(this->station));
    314         this->setAbsDir(this->originDir * this->stations->getRelTargetDir(this->station));
     314        this->setAbsDir(VtoQ(this->originDir + this->stations->getRelTargetDir(this->station)));
    315315
    316316        if (this->stations->getEndingSound(this->station).loaded())
     
    319319
    320320        this->originCoor = this->originCoor + this->stations->getRelTargetCoor(this->station);
    321         this->originDir = this->originDir * this->stations->getRelTargetDir(this->station);
     321        this->originDir = this->originDir + this->stations->getRelTargetDir(this->station);
    322322       
    323323        return STAY;
     
    345345    if (this->stations)
    346346        if ((this->getAbsCoor() - (this->originCoor + this->stations->getRelTargetCoor(this->station))).len() <= 1.2 * (this->stations->getVelocity(this->station) * dt).len())
    347             if (fabs((this->getAbsDir() / (this->originDir * this->stations->getRelTargetDir(this->station))).w) <= 1.2 * fabs(this->stations->getRotation(this->station).w * dt))
     347            if ((this->getAbsDir().getRotation() - (this->originDir + this->stations->getRelTargetDir(this->station))).len() <= 1.2 * (this->stations->getRotation(this->station) * dt).len())
    348348                return true;
    349349
  • data/contentcreation/pps/FabianLandau/mover/environments/mover.h

    r4844 r4855  
    4646        int stay();
    4747        bool reachedStationsTarget(float dt);
     48        Quaternion VtoQ(Vector v) { return Quaternion(v.x, v.y, v.z); }
     49        Vector QtoV(Quaternion Q) { return Vector(); }
    4850
    4951        bool                        bLoop;
     
    6466        int                         repeatsToGo;
    6567        Vector                      originCoor;
    66         Quaternion                  originDir;
     68        Vector                      originDir;
    6769
    6870        OrxSound::SoundSource       soundSource_starting;
  • data/contentcreation/pps/FabianLandau/mover/environments/mover_station.cc

    r4844 r4855  
    2828    this->rank = 0;
    2929    this->relTargetCoor = Vector(0, 0, 0);
    30     this->relTargetDir = Quaternion(0, Vector(0, 0, 0));
     30    this->relTargetDir = Vector(0, 0, 0);
    3131    this->delay = 0;
    3232    this->movingTime = 0;
     
    6060        .defaultValues(0, 0, 0);
    6161    LoadParam(root, "rel-target-dir", this, MoverStation, setRelTargetDir)
    62         .describe("The relative direction of the stations target.")
    63         .defaultValues(0, 0, 0, 0);
     62        .describe("The relative direction of the stations target in all axes (roll/pitch/yaw).")
     63        .defaultValues(0, 0, 0);
    6464    LoadParam(root, "delay", this, MoverStation, setDelay)
    6565        .describe("The amount of time the mover waits, before he starts moving.")
     
    9999    {
    100100        this->relTargetCoor = Vector(0, 0, 0);
    101         this->relTargetDir = Quaternion(0, Vector(0, 0, 0));
     101        this->relTargetDir = Vector(0, 0, 0);
    102102    }
    103103}
  • data/contentcreation/pps/FabianLandau/mover/environments/mover_station.h

    r4844 r4855  
    2525
    2626        void setRank(int id) { this->rank = id; }
    27         void setRelTargetCoor(float x, float y, float z) { this->relTargetCoor = Vector(x, y, z); }
    28         void setRelTargetDir(float w, float x, float y, float z) { this->relTargetDir = Quaternion(w, Vector(x, y, z)); }
     27        void setRelTargetCoor(float x = 0, float y = 0, float z = 0) { this->relTargetCoor = Vector(x, y, z); }
     28        void setRelTargetDir(float wx = 0, float wy = 0, float wz = 0) { this->relTargetDir = Vector(wx, wy, wz); }
    2929        void setDelay(float t) { this->delay = t; }
    3030        void setMovingTime(float t) { this->movingTime = t; }
     
    4545        int                     rank;
    4646        Vector                  relTargetCoor;
    47         Quaternion              relTargetDir;
     47        Vector                  relTargetDir;
    4848        float                   delay;
    4949        float                   movingTime;
  • data/contentcreation/pps/FabianLandau/mover/environments/mover_station_list.cc

    r4844 r4855  
    236236}
    237237
    238 Quaternion MoverStationList::getTotalRelDir(MoverStation *station)
     238Vector MoverStationList::getTotalRelDir(MoverStation *station)
    239239{
    240240    MoverStationListElement *temp = this->first;
    241     Quaternion totalRelDir = Quaternion(0, Vector(0, 0, 0));
     241    Vector totalRelDir = Vector(0, 0, 0);
    242242   
    243243    if (station)
     
    247247            while (temp != 0)
    248248            {
    249                 totalRelDir *= temp->station->relTargetDir;
     249                totalRelDir += temp->station->relTargetDir;
    250250                if (temp->station == station)
    251251                    break;
     
    260260                while (temp->next != 0)
    261261                {
    262                     totalRelDir *= temp->next->station->relTargetDir;
     262                    totalRelDir += temp->next->station->relTargetDir;
    263263                    if (temp->next->station == station)
    264264                        break;
     
    336336}
    337337
    338 Quaternion MoverStationList::getRelTargetDir(MoverStation *station)
     338Vector MoverStationList::getRelTargetDir(MoverStation *station)
    339339{
    340340    if (station)
     
    345345                return station->relTargetDir;
    346346            else
    347                 return station->relTargetDir.inverse();
     347                return station->relTargetDir * -1;
    348348        }
    349349        else
     
    354354            {
    355355                if (this->goForward)
    356                     return (station->relTargetDir / this->getTotalRelDir(moveToStation)).inverse();
     356                    return (station->relTargetDir - this->getTotalRelDir(moveToStation)) * -1;
    357357                else
    358                     return (station->relTargetDir / this->getTotalRelDir(moveToStation));
    359             }
    360         }
    361     }
    362    
    363     return Quaternion(0, Vector(0, 0, 0));
     358                    return station->relTargetDir - this->getTotalRelDir(moveToStation);
     359            }
     360        }
     361    }
     362   
     363    return Vector(0, 0, 0);
    364364}
    365365
    366366Vector MoverStationList::getVelocity(MoverStation *station)
    367367{
    368     Vector velocity = Vector(0, 0, 0);
    369 
    370368    if (station)
    371369        if (station->movingTime != 0)
    372             velocity = this->getRelTargetCoor(station) / station->movingTime;
    373 
    374     return velocity;
    375 }
    376 
    377 Quaternion MoverStationList::getRotation(MoverStation *station)
    378 {
    379     Quaternion rotation = Quaternion(0, Vector(0, 0, 0));
    380 
     370            return this->getRelTargetCoor(station) / station->movingTime;
     371
     372    return Vector(0, 0, 0);
     373}
     374
     375Vector MoverStationList::getRotation(MoverStation *station)
     376{
    381377    if (station)
    382378        if (station->movingTime != 0)
    383             rotation = Quaternion(this->getRelTargetDir(station).w / station->movingTime, this->getRelTargetDir(station).v);
    384 
    385     return rotation;
     379            return this->getRelTargetDir(station) / station->movingTime;
     380
     381    return Vector(0, 0, 0);
    386382}
    387383
  • data/contentcreation/pps/FabianLandau/mover/environments/mover_station_list.h

    r4844 r4855  
    3232        MoverStation *getNextStation(MoverStation *station);
    3333        Vector getTotalRelCoor(MoverStation *station);
    34         Quaternion getTotalRelDir(MoverStation *station);
     34        Vector getTotalRelDir(MoverStation *station);
    3535        bool isOpen(MoverStation *station);
    3636        bool isClosed(MoverStation *station);
     
    3838
    3939        Vector getRelTargetCoor(MoverStation *station);
    40         Quaternion getRelTargetDir(MoverStation *station);
     40        Vector getRelTargetDir(MoverStation *station);
    4141        float getDelay(MoverStation *station) { return station->delay; }
    4242        float getStayOpenTime(MoverStation *station) { return station->stayOpenTime; }
    4343        float getMovingTime(MoverStation *station) { return station->movingTime; }
    4444        Vector getVelocity(MoverStation *station);
    45         Quaternion getRotation(MoverStation *station);
     45        Vector getRotation(MoverStation *station);
    4646        OrxSound::SoundBuffer getStartingSound(MoverStation *station);
    4747        OrxSound::SoundBuffer getMovingSound(MoverStation *station);
Note: See TracChangeset for help on using the changeset viewer.