Changeset 10096 in orxonox.OLD for branches/playability/src/util/track
- Timestamp:
- Dec 19, 2006, 2:52:29 PM (18 years ago)
- Location:
- branches/playability/src/util/track
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/track/track.cc
r10091 r10096 59 59 { 60 60 this->curveType = CURVE_BEZIER; 61 this->startingTime = 0;61 // this->startingTime = 0; 62 62 this->duration = 10; 63 this->endTime = 1 ;63 this->endTime = 10; 64 64 this->width = 10; 65 65 this->curve = new BezierCurve(); … … 90 90 91 91 /** 92 * 92 * This function adds a point with its coordinates to the track 93 93 * @param x 94 94 * @param y … … 102 102 103 103 /** 104 * 104 * This function adds a point to the track as a vector 105 105 * @param newPoint 106 106 */ … … 112 112 113 113 /** 114 * 114 * We probably doesn't even need this 115 115 */ 116 116 void Track::finalize() … … 160 160 Vector Track::calcPos() const 161 161 { 162 return this->curve->calcPos( (this->localTime-this->startingTime)/this->duration);162 return this->curve->calcPos(this->localTime/this->duration); 163 163 } 164 164 165 165 Vector Track::calcDir() const 166 166 { 167 return this->curve->calcDir( (this->localTime - this->startingTime)/this->duration);167 return this->curve->calcDir(this->localTime/this->duration); 168 168 } 169 169 … … 174 174 // this->jumpTo(this->localTime); 175 175 // if (this->localTime <= this->maxTime) 176 //this->localTime += dt;176 this->localTime += dt; 177 177 // if (this->localTime > this->currentTrackElem->endTime 178 178 // && this->currentTrackElem->children) … … 190 190 // } 191 191 // } 192 // if (this->bindSlave) 193 // { 194 // Vector tmp = this->calcPos(); 195 // Quaternion quat = Quaternion(this->calcDir(), Vector(this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).x,1,this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).z)); 196 // 197 // Vector v(0.0, 1.0, 0.0); 198 // Quaternion q(-PI/2, v); 199 // quat = quat * q; 200 // 201 // this->bindSlave->setAbsCoor(tmp); 202 // this->bindSlave->setAbsDir(quat); 203 // } 192 if (this->trackNode) 193 { 194 Vector tmp = this->calcPos(); 195 Quaternion quat = Quaternion(this->calcDir(), Vector(this->curve->calcAcc(this->localTime/this->duration).x,1,this->curve->calcAcc(this->localTime/this->duration).z)); 196 197 Vector v(0.0, 1.0, 0.0); 198 Quaternion q(-PI/2, v); 199 quat = quat * q; 200 201 // move trackNode of the track 202 this->trackNode->setAbsCoor(tmp); 203 // set direction and roll angle of trackNode 204 this->trackNode->setAbsDir(quat); 205 } 204 206 } 205 207 -
branches/playability/src/util/track/track.h
r10091 r10096 33 33 PNode* getTrackNode(); 34 34 35 float startingTime; //!< The time at which this Track begins.35 //float startingTime; //!< The time at which this Track begins. 36 36 float duration; //!< The time used to cross this Track (curve). 37 37 float endTime; //!< The time at which this Track ends.
Note: See TracChangeset
for help on using the changeset viewer.