Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10297 in orxonox.OLD for branches/playability/src/util/track


Ignore:
Timestamp:
Jan 20, 2007, 9:27:04 PM (18 years ago)
Author:
bknecht
Message:

track now works a bit can be partly used now

Location:
branches/playability/src/util/track
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/util/track/track.cc

    r10284 r10297  
    6565  this->curveType = CURVE_BEZIER;
    6666//  this->startingTime = 0;
    67   this->duration = 10;
    68   this->endTime = 10;
     67  this->duration = 20;
     68  this->endTime = 20;
    6969  this->width = 10;
    7070  this->curve = new BezierCurve();
     
    8888           LoadParam_CYCLE(element, "addPoint", this, Track, addPoint)
    8989             .describe("Adds a new Point to the currently selected TrackElement");
     90           LoadParam_CYCLE(element, "speed", this, Track, setSpeed)
     91             .describe("Sets speed of traveling");
    9092
    9193     }
     
    116118   if( this->nodeCount == 0) this->trackNode->setAbsCoor(newPoint);
    117119   this->nodeCount++;
    118    PRINTF(4)("Point added to curve %d\n");
     120   // PRINTF(0)("Point added to curve\n");
     121}
     122
     123/**
     124 * This function sets the speed of the trackNode by altering the duration
     125 * of the time the trackNode travels on the whole track. This is bad because
     126 * the speed depends on the length of the curve. (by getting the curve's length
     127 * this function will make a lot more sense)
     128 */
     129void Track::setSpeed(float speed)
     130{
     131     this->duration = this->duration/speed;
     132     
    119133}
    120134
     
    211225       this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor());
    212226       // set direction and roll angle of trackNode
    213        // this->trackNode->setAbsDir(quat);
     227       this->trackNode->setAbsDir(quat);
    214228     }
    215229}
     
    230244   eventually this will all be packed into a gl-list.
    231245*/
    232 void Track::drawGraph(float dt) const
     246/*void Track::drawGraph(float dt) const
    233247{
    234248      glBegin(GL_LINE_STRIP);
     
    240254          }
    241255      glEnd();
    242 }
     256}*/
  • branches/playability/src/util/track/track.h

    r10284 r10297  
    2525   void addPoint(float x, float y, float z);
    2626   void addPointV(Vector newPoint);
     27   void setSpeed(float speed);
    2728
    2829   //void finalize();
     
    3334   PNode* getTrackNode();
    3435   
    35    void drawGraph(float dt) const;
     36//   void drawGraph(float dt) const;
    3637     
    3738   //float                 startingTime;         //!< The time at which this Track begins.
Note: See TracChangeset for help on using the changeset viewer.