Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2012, 5:08:35 PM (12 years ago)
Author:
scmoritz
Message:

3D arrow added. Spinns around like crazy. the partyarrow needs a fix :)

Location:
code/branches/waypoints/src/modules/overlays/hud
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.cc

    r9177 r9219  
    8787
    8888    Model* arrow = new Model(this);
    89     MovableEntity* arrowEntity = new MovableEntity(this);
     89    this->arrowEntity = new MovableEntity(this);
    9090    arrow->setMeshSource("Arrow3D.mesh");
    91     arrowEntity->attach(arrow);
    92     arrowEntity->setVisible(true);
    93     arrowEntity->scale(1);
    94     arrowEntity->setPosition(0, 0, -200);
    95     arrowEntity->attachToNode(this->overlay3d_);
     91    arrow->setSyncMode(0);
     92    this->arrowEntity->attach(arrow);
     93    this->arrowEntity->scale(1);
     94    this->arrowEntity->setVisible(true);
     95    this->arrowEntity->setPosition(0, +30, -100);
     96    this->arrowEntity->setSyncMode(0);
     97    this->arrowEntity->attachToNode(this->overlay3d_);
    9698    //this->add3DMesh(arrowEntity);
    9799
    98     this->overlay3d_->setPosition(0, 0, -200);
    99     this->overlay3d_->setVisible(false, true);
     100    //this->overlay3d_->setPosition(0, 0, 0);
     101    //this->overlay3d_->setVisible(false, true);
     102    this->overlay_->setZOrder(0);
     103    this->overlay_->show();
     104    hideArrow3D();
    100105}
    101106
     
    198203
    199204    //for the first element of sortedObjectList_ / the closest waypoint show the Arrow3D
     205    //set the direction of the arrow to the closest waypoint
    200206    if(!sortedObjectList_.empty())
    201207    {
    202208        showArrow3D();
    203209                sortedList::iterator firstIt = sortedObjectList_.begin();
    204                 Ogre::Vector3 pos1 = firstIt->first->getRVWorldPosition();
    205                 Ogre::Vector3 pos2 = cam->getPosition();
    206                 Ogre::Quaternion quat = pos2.getRotationTo(pos1);
    207                 this->overlay3d_->rotate(quat);
    208                 //this->overlay3d_->setDirection(pos1-pos2);
    209     }
     210
     211                Ogre::Vector3 pos1 = camTransform * firstIt->first->getRVWorldPosition();
     212                orxout(user_info, context::events()) << pos1 << endl;
     213                this->arrowEntity->setDirection(1-pos1.x, 1 - pos1.y, 1 - pos1.z);
     214
     215                //this->arrowEntity->rotate(quat);
     216                //this->overlay3d_->setDirection(pos1);
     217    }
     218    else{hideArrow3D();}
    210219
    211220
     
    413422    this->background_->addChild ( text );
    414423
    415     sortedObjectList_.push_front ( std::make_pair ( object, ( unsigned int ) 0 ) );
     424    Ogre::Vector3 temp = object->getWorldEntity()->getPosition();
     425    unsigned int distance = sqrt(temp.x*temp.x+temp.y*temp.y+temp.z*temp.z);
     426
     427
     428
     429    sortedObjectList_.push_front ( std::make_pair ( object, distance ) );
    416430
    417431
  • code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.h

    r9177 r9219  
    8787    void hideArrow3D();
    8888
     89    orxonox::MovableEntity* arrowEntity;
     90
    8991    bool showObject( RadarViewable* rv );
    9092
Note: See TracChangeset for help on using the changeset viewer.