Changeset 10454 in orxonox.OLD for trunk/src/util/track
- Timestamp:
- Jan 28, 2007, 6:35:43 PM (18 years ago)
- Location:
- trunk/src/util/track
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/track/track.cc
r10449 r10454 132 132 { 133 133 this->duration = this->duration/speed; 134 134 this->speed = speed; 135 135 } 136 136 … … 206 206 // this->jumpTo(this->localTime); 207 207 // if (this->localTime <= this->maxTime) 208 if(this->mode == 0) 209 { 210 if(this->localTime < this->duration) 211 this->localTime += dt; 212 } 213 else 214 { 215 this->localTime += dt; 216 if(this->localTime >= this->duration) 217 this->localTime = 0; 218 } 208 219 209 220 210 // if (this->localTime > this->currentTrackElem->endTime … … 235 225 if (this->trackNode) 236 226 { 227 // tmp save 228 float oldTime = this->localTime; 229 230 if(this->mode == 0) 231 { 232 if(this->localTime < this->duration) 233 this->localTime += dt; 234 } 235 else 236 { 237 this->localTime += dt; 238 if(this->localTime >= this->duration) 239 this->localTime = 0; 240 } 241 237 242 Vector tmp = this->calcPos(); 238 //Quaternion quat = Quaternion(this->calcDir(), Vector(this->curve->calcAcc(this->localTime/this->duration).x,1,this->curve->calcAcc(this->localTime/this->duration).z)); 239 243 244 245 Vector dV = tmp - this->trackNode->getAbsCoor(); 246 float dx = speed * dt; 247 float ratio = dx / dV.len(); 248 249 if( dt > 0.0f) 250 { 251 float newDt = dt * ratio; 252 this->localTime = oldTime += newDt; 253 } 254 tmp = this->calcPos(); 240 255 241 256 Vector v(0.0, 1.0, 0.0); -
trunk/src/util/track/track.h
r10410 r10454 38 38 39 39 //float startingTime; //!< The time at which this Track begins. 40 float speed; 40 41 float duration; //!< The time used to cross this Track (curve). 41 42 float endTime; //!< The time at which this Track ends.
Note: See TracChangeset
for help on using the changeset viewer.