Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10096 in orxonox.OLD for branches/playability


Ignore:
Timestamp:
Dec 19, 2006, 2:52:29 PM (18 years ago)
Author:
bknecht
Message:

connected the track with the worldentities and the spaceship

Location:
branches/playability/src
Files:
5 edited

Legend:

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

    r10091 r10096  
    5959{
    6060  this->curveType = CURVE_BEZIER;
    61   this->startingTime = 0;
     61//  this->startingTime = 0;
    6262  this->duration = 10;
    63   this->endTime = 1;
     63  this->endTime = 10;
    6464  this->width = 10;
    6565  this->curve = new BezierCurve();
     
    9090
    9191/**
    92  *
     92 * This function adds a point with its coordinates to the track
    9393 * @param x
    9494 * @param y
     
    102102
    103103/**
    104  *
     104 * This function adds a point to the track as a vector
    105105 * @param newPoint
    106106 */
     
    112112
    113113/**
    114  *
     114 * We probably doesn't even need this
    115115 */
    116116void Track::finalize()
     
    160160Vector Track::calcPos() const
    161161{
    162   return this->curve->calcPos((this->localTime-this->startingTime)/this->duration);
     162  return this->curve->calcPos(this->localTime/this->duration);
    163163}
    164164
    165165Vector Track::calcDir() const
    166166{
    167   return this->curve->calcDir((this->localTime - this->startingTime)/this->duration);
     167  return this->curve->calcDir(this->localTime/this->duration);
    168168}
    169169
     
    174174//     this->jumpTo(this->localTime);
    175175//   if (this->localTime <= this->maxTime)
    176 //     this->localTime += dt;
     176     this->localTime += dt;
    177177//   if (this->localTime > this->currentTrackElem->endTime
    178178//       && this->currentTrackElem->children)
     
    190190//         }
    191191//     }
    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     }
    204206}
    205207
  • branches/playability/src/util/track/track.h

    r10091 r10096  
    3333   PNode* getTrackNode();
    3434     
    35    float                 startingTime;         //!< The time at which this Track begins.
     35   //float                 startingTime;         //!< The time at which this Track begins.
    3636   float                 duration;             //!< The time used to cross this Track (curve).
    3737   float                 endTime;              //!< The time at which this Track ends.
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10095 r10096  
    5555#include "util/loading/load_param.h"
    5656#include "time.h"
     57
     58#include "track/track.h"
    5759
    5860
     
    477479  else
    478480    this->secWeaponMan.releaseFire();
     481   
     482  // Tracktick
     483  if(this->entityTrack)
     484    this->entityTrack->tick(time);
    479485
    480486
     
    760766        this->travelNode->updateNode(0.01f);
    761767
    762         this->setParent(this->travelNode);
     768        //this->setParent(this->travelNode);
    763769        this->setRelCoor(0,0,0);
    764770
    765         State::getCameraNode()->setParentSoft(this->travelNode);
     771        //State::getCameraNode()->setParentSoft(this->travelNode);
     772        State::getCameraNode()->setParentSoft(this);
    766773        State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0);
    767         State::getCameraTargetNode()->setParentSoft(this->travelNode);
     774        //State::getCameraTargetNode()->setParentSoft(this->travelNode);
     775        State::getCameraTargetNode()->setParentSoft(this);
    768776        State::getCameraTargetNode()->setRelCoorSoft(0,0,0);
    769777
  • branches/playability/src/world_entities/world_entity.cc

    r10088 r10096  
    168168void WorldEntity::addTrack(const TiXmlElement* root)
    169169{
     170     
     171  this->entityTrack = new Track();
     172  this->setParent(this->entityTrack->getTrackNode());
     173  this->entityTrack->getTrackNode()->setParentMode(PNODE_ALL);
    170174  LOAD_PARAM_START_CYCLE(root, element);
    171175  {
     
    174178  }
    175179  LOAD_PARAM_END_CYCLE(element);
     180 
     181
    176182}
    177183
     
    635641*/
    636642void WorldEntity::tick(float time)
    637 {}
     643{
     644}
    638645
    639646
  • branches/playability/src/world_entities/world_entity.h

    r10088 r10096  
    221221  bool                    bOnGround;                       //!< true if this entity is standing on the ground
    222222
    223 
    224   Track*                  entityTrack;                     //!< this is the track this entity follows (or NULL if none)
    225 
    226223protected:
    227224  Vector                  velocity;                        //!< speed of the entity
     225  Track*                  entityTrack;                     //!< this is the track this entity follows (or NULL if none)
    228226
    229227};
Note: See TracChangeset for help on using the changeset viewer.