Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3516 in orxonox.OLD for orxonox/branches/trackManager


Ignore:
Timestamp:
Mar 12, 2005, 4:00:06 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/trackManager: now nearest works… this was rather strange
what is important is, that the nearest node is not too far from the center (if there is a 3-fork :)

Location:
orxonox/branches/trackManager/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/trackManager/src/story_entities/world.cc

    r3515 r3516  
    116116      trackManager->addPoint(Vector(30,0,5));
    117117      trackManager->addPoint(Vector(40,0,5));
    118       trackManager->setDuration(2);
    119       trackManager->setSavePoint();
    120       trackManager->addPoint(Vector(50,10,10));
    121       trackManager->addPoint(Vector(60,0, 10));
    122       trackManager->addPoint(Vector(70,0, 10));
    123       trackManager->addPoint(Vector(80,0,-10));
    124       trackManager->addPoint(Vector(90,0,-10));
    125       trackManager->setDuration(5);
    126       trackManager->setSavePoint();
    127       trackManager->addPoint(Vector(110,0,5));
    128       trackManager->addPoint(Vector(120,0, 10));
    129       trackManager->addPoint(Vector(130,0, 10));
    130       trackManager->addPoint(Vector(140,0,-10));
    131       trackManager->addPoint(Vector(150,0,-10));
    132118      trackManager->setDuration(3);
    133       int fork11, fork12, fork13, fork14;
    134       trackManager->fork(4, &fork11, &fork12, &fork13, &fork14);
     119      int fork11, fork12, fork13;
     120      trackManager->fork(3, &fork11, &fork12, &fork13);
    135121      trackManager->workOn(fork11);
    136       trackManager->addPoint(Vector(170, 0, -15));
    137       trackManager->addPoint(Vector(180, 0, -15));
     122      trackManager->addPoint(Vector(70, 0, -10));
     123      trackManager->addPoint(Vector(100, 0, -15));
    138124      trackManager->setDuration(3);
    139125      trackManager->workOn(fork12);
    140       trackManager->addPoint(Vector(170, 0, 10));
    141       trackManager->addPoint(Vector(180, 0, 10));
    142       trackManager->addPoint(Vector(190,2,5));
    143       trackManager->addPoint(Vector(200,2,5));
     126      trackManager->addPoint(Vector(70,  0, 0));
     127      trackManager->addPoint(Vector(100, 0, 0));
     128      trackManager->addPoint(Vector(120,10, 0));
     129      trackManager->addPoint(Vector(150,10, 0));
    144130      trackManager->setDuration(7);
    145       int fork21, fork22;
    146       trackManager->fork(2, &fork21, &fork22);
    147       trackManager->workOn(fork21);
    148       trackManager->addPoint(Vector(220, 10,-10));
    149       trackManager->addPoint(Vector(230, 0,-10));
    150       trackManager->addPoint(Vector(240, 0, 2));
    151       trackManager->addPoint(Vector(250, 0, 0));
    152       trackManager->addPoint(Vector(260, 0, 5));
    153       trackManager->setDuration(3);
    154       trackManager->join(2, fork12, fork11);
    155       trackManager->workOn(fork22);
    156       trackManager->addPoint(Vector(220, -10,10));
    157       trackManager->addPoint(Vector(230, 0, 10));
    158       trackManager->addPoint(Vector(240, 0, 10));
    159       trackManager->addPoint(Vector(250, 0, 5));
    160       trackManager->setDuration(6);
    161131      trackManager->workOn(fork13);
    162       trackManager->addPoint(Vector(200,-10,5));
    163       trackManager->addPoint(Vector(250,-10,5));
    164       trackManager->setDuration(3);
    165       trackManager->workOn(fork14);
    166       trackManager->addPoint(Vector(200,15,0));
    167       trackManager->addPoint(Vector(210,0,10));
    168       trackManager->setDuration(1);
    169       trackManager->join(4, fork21, fork22, fork13, fork14);
    170       trackManager->workOn(10);
    171       trackManager->addPoint(Vector(250,-10,5));
    172       trackManager->addPoint(Vector(260,-10,5));
     132      trackManager->addPoint(Vector(70,  0, 10));
     133      trackManager->addPoint(Vector(100, 0, 30));
     134      trackManager->addPoint(Vector(120,-10, 30));
     135      trackManager->addPoint(Vector(150,-10, 30));
     136
    173137      trackManager->finalize();
    174138     
     
    240204
    241205            trackManager->setBindSlave(TrackNode::getInstance());
    242             trackManager->condition(3, LEFTRIGHT, myPlayer);
     206            trackManager->condition(1, NEAREST, myPlayer);
    243207            TrackNode::getInstance()->addChild(myPlayer);
    244208            TrackNode::getInstance()->addChild(localCamera);
  • orxonox/branches/trackManager/src/track_manager.cc

    r3515 r3516  
    148148
    149149  Vector nodeRelCoord = tmpNode->relCoordinate;
    150 
    151   if (nodeRelCoord.z < 0)
    152     return 0;
    153   else
    154     return 1;
     150  float minDist = 100000000;
     151  int nodeNumber = 0;
     152  for (int i = 0; i < this->childCount; i++)
     153    {
     154      float dist = (nodeRelCoord - this->children[i]->curve->getNode(4)).len();
     155      if (dist < minDist)
     156        {
     157          minDist = dist;
     158          nodeNumber = i;
     159        }
     160    }
     161  PRINTF(3)("PathDecision with nearest algorithm: %d\n", nodeNumber);
     162  return nodeNumber;
    155163}
    156164
     
    432440      break;
    433441    case ENEMYKILLED:
    434       break;
    435     default: // same as LOWEST
    436       tmpElem->condFunc = &TrackElement::lowest;
    437442      break;
    438443    }
Note: See TracChangeset for help on using the changeset viewer.