Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3371 in orxonox.OLD for orxonox/branches/trackManager


Ignore:
Timestamp:
Jan 7, 2005, 3:07:12 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/trackManager: now env moves along the Path. but the Path does not decide for different tracks

Location:
orxonox/branches/trackManager/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/trackManager/src/p_node.cc

    r3369 r3371  
    226226*/
    227227void PNode::setAbsDir (Quaternion* absDir)
    228 {}
     228{
     229  this->bAbsDirChanged = true;
     230  this->absDirection = *absDir;
     231}
    229232
    230233
  • orxonox/branches/trackManager/src/track_manager.cc

    r3369 r3371  
    1919#include "track_manager.h"
    2020#include <stdarg.h>
    21 
     21#include "p_node.h"
    2222
    2323using namespace std;
     
    111111  this->maxTime = 0;
    112112  this->trackElemCount = 1;
     113  this->bindSlave = NULL;
    113114}
    114115
     
    440441void TrackManager::tick(float dt)
    441442{
     443  dt /= 1000;
     444  printf("LocalTime is: %f, timestep is: %f\n", this->localTime, dt);
    442445  if (this->localTime <= this->firstTrackElem->duration)
    443446    this->jumpTo(this->localTime);
     447  printf("LocalTime is: %f, timestep is: %f\n", this->localTime, dt);
    444448  this->localTime += dt;
    445449  if (this->localTime > this->currentTrackElem->startingTime + this->currentTrackElem->duration && this->currentTrackElem->childCount > 0)
    446450    this->currentTrackElem = this->currentTrackElem->children[0];
     451  if (this->bindSlave)
     452    {
     453      Vector tmp = this->calcPos();
     454      Quaternion quat = Quaternion(this->calcDir(), Vector(0,1,0));
     455      this->bindSlave->setAbsCoor(&tmp);
     456      this->bindSlave->setAbsDir(&quat);
     457    }
    447458}
    448459
     
    471482}
    472483
     484/**
     485   \brief Sets the PNode, that should be moved along the Tack
     486   \param bindSlave the PNode to set
     487*/
     488void TrackManager::setBindSlave(PNode* bindSlave)
     489{
     490  if (!this->bindSlave)
     491    this->bindSlave = bindSlave;
     492}
    473493
    474494
  • orxonox/branches/trackManager/src/track_manager.h

    r3369 r3371  
    1414#include "stdincl.h"
    1515
     16class PNode;
    1617
    1718//! condition for choosing a certain Path. \todo implement a useful way.
     
    104105  float maxTime;                      //!< The maximal time the track has.
    105106  int trackElemCount;                 //!< The count of TrackElements that exist.
     107  PNode* bindSlave;
    106108 
    107109  void initChildren(unsigned int childCount);
     
    134136  void choosePath(int graphID);
    135137
     138  void setBindSlave(PNode* bindSlave);
     139
    136140  // DEBUG //
    137141  void drawGraph(float dt) const;
  • orxonox/branches/trackManager/src/world.cc

    r3369 r3371  
    175175      trackManager->addPoint(Vector(30,0,5));
    176176      trackManager->addPoint(Vector(40,0,5));
    177       trackManager->setDuration(.5);
     177      trackManager->setDuration(2);
    178178      trackManager->setSavePoint();
    179179      trackManager->addPoint(Vector(50,10,10));
     
    182182      trackManager->addPoint(Vector(80,0,-10));
    183183      trackManager->addPoint(Vector(90,0,-10));
    184       trackManager->setDuration(.5);
     184      trackManager->setDuration(5);
    185185      trackManager->setSavePoint();
    186186      trackManager->addPoint(Vector(110,0,5));
     
    189189      trackManager->addPoint(Vector(140,0,-10));
    190190      trackManager->addPoint(Vector(150,0,-10));
    191       trackManager->setDuration(.5);
     191      trackManager->setDuration(3);
    192192      int fork11, fork12, fork13, fork14;
    193193      trackManager->fork(4, &fork11, &fork12, &fork13, &fork14);
     
    195195      trackManager->addPoint(Vector(170, 0, -15));
    196196      trackManager->addPoint(Vector(180, 0, -15));
     197      trackManager->setDuration(3);
    197198      trackManager->workOn(fork12);
    198199      trackManager->addPoint(Vector(170, 0, 10));
     
    200201      trackManager->addPoint(Vector(190,2,5));
    201202      trackManager->addPoint(Vector(200,2,5));
     203      trackManager->setDuration(7);
    202204      int fork21, fork22;
    203205      trackManager->fork(2, &fork21, &fork22);
     
    208210      trackManager->addPoint(Vector(250, 0, 0));
    209211      trackManager->addPoint(Vector(260, 0, 5));
     212      trackManager->setDuration(3);
    210213      trackManager->join(2, fork12, fork11);
    211214      trackManager->workOn(fork22);
     
    214217      trackManager->addPoint(Vector(240, 0, 10));
    215218      trackManager->addPoint(Vector(250, 0, 5));
     219      trackManager->setDuration(6);
    216220      trackManager->workOn(fork13);
    217221      trackManager->addPoint(Vector(200,-10,5));
    218222      trackManager->addPoint(Vector(250,-10,5));
    219       printf("fork14: %d\n", fork14);
     223      trackManager->setDuration(3);
    220224      trackManager->workOn(fork14);
    221225      trackManager->addPoint(Vector(200,15,0));
    222226      trackManager->addPoint(Vector(210,0,10));
    223 
     227      trackManager->setDuration(1);
    224228
    225229
     
    273277            this->spawn (myPlayer);
    274278            this->localPlayer = myPlayer;           
    275 
    276279            // bind input
    277280            Orxonox *orx = Orxonox::getInstance ();
     
    290293            env->setName ("env");
    291294            this->spawn(env, es, qs);
    292 
     295            trackManager->setBindSlave(env);
    293296
    294297            break;
     
    541544  trackManager->drawGraph(.01);
    542545  trackManager->debug(2);
    543   delete trackManager;
    544546 
    545547  /*
     
    651653          t = loc->part;
    652654         
    653           if( t >= tracklen )
     655          if( t >= traclen )
    654656            {
    655657              printf("An entity is out of the game area\n");
     
    882884      this->update ();
    883885      this->localCamera->timeSlice(dt);
     886      this->trackManager->tick(dt);
    884887    }
    885888  this->lastFrame = currentFrame;
Note: See TracChangeset for help on using the changeset viewer.