Changeset 10698 in orxonox.OLD for trunk/src/util/track
- Timestamp:
- Jun 14, 2007, 5:33:43 PM (18 years ago)
- Location:
- trunk/src/util/track
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/track/track.cc
r10618 r10698 29 29 30 30 #include "debug.h" 31 #include "action_box.h" 31 32 32 33 ObjectListDefinition(Track); … … 65 66 this->duration = 20; 66 67 this->endTime = 20; 67 this->width = 10; 68 this->width = 24; 69 this->height = 18; 70 this->depth = 200; 71 this->stretch = 4; 68 72 this->curve = new BezierCurve(); 69 73 this->trackNode = new PNode(PNode::getNullParent(), PNODE_ALL); … … 71 75 this->localTime = 0; 72 76 this->pause = false; 77 78 this->actionBox = NULL; 73 79 } 74 80 … … 94 100 } 95 101 LOAD_PARAM_END_CYCLE(element); 102 103 LoadParam(root, "ActionBox", this, Track, addActionBox ); 96 104 } 97 105 … … 252 260 { 253 261 Vector tmp = this->calcPos(); 254 255 262 263 256 264 Vector dV = tmp - this->trackNode->getAbsCoor(); 257 265 float dx = speed * dt; 258 266 float ratio = dx / dV.len(); 259 267 260 268 if( dt > 0.0f) 261 269 { … … 264 272 } 265 273 tmp = this->calcPos(); 266 274 267 275 Vector v(0.0, 1.0, 0.0); 268 276 Quaternion quat = Quaternion(this->calcDir(), v); 269 277 Quaternion q(-PI/2, v); 270 278 quat = quat * q; 271 279 272 280 // move trackNode of the track 273 281 this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor()); … … 331 339 glPopMatrix(); 332 340 } 341 342 /** 343 * creates new action box and assignes it to this track 344 * @param width_2 width/2 of near end 345 * @param height_2 height/2 of near end 346 * @param depth depth 347 * @param stretch far end will be stretched with this factor 348 */ 349 void Track::addActionBox( float width_2, float height_2, float depth, float stretch ) 350 { 351 actionBox = new ActionBox( this, width_2, height_2, depth, stretch ); 352 } 353 354 355 -
trunk/src/util/track/track.h
r10498 r10698 12 12 class PNode; 13 13 class TiXmlElement; 14 class ActionBox; 14 15 15 16 class Track : public BaseObject … … 42 43 float duration; //!< The time used to cross this Track (curve). 43 44 float endTime; //!< The time at which this Track ends. 44 float width; //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right. 45 float width; //!< The width of the action box, next to the player. 46 float height; //!< The Height of the action box, next to the player 47 float depth; //!< Depth of the action box 48 float stretch; //!< multiplyer between w/h at player and w/h at far end of the action box 45 49 46 50 int nodeCount; //!< The count of points this Track has. 47 51 Curve* curve; //!< The Curve of this Track 52 53 ActionBox* getActionBox(){ return this->actionBox; } 48 54 49 55 private: 50 56 void init(); 51 52 57 53 58 private: 54 59 CurveType curveType; //!< The CurveType the entire TrackSystem will have. … … 57 62 int mode; //!< Defines the behaviour of the Track. 58 63 bool pause; //!< Defines if the track runs (false) or not (true) 64 65 ActionBox* actionBox; 66 67 void addActionBox( float width_2, float height_2, float depth, float stretch ); 68 69 59 70 }; 60 71
Note: See TracChangeset
for help on using the changeset viewer.