Changeset 9219 for code/branches/waypoints/src/modules
- Timestamp:
- May 18, 2012, 5:08:35 PM (13 years ago)
- 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 87 87 88 88 Model* arrow = new Model(this); 89 MovableEntity*arrowEntity = new MovableEntity(this);89 this->arrowEntity = new MovableEntity(this); 90 90 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_); 96 98 //this->add3DMesh(arrowEntity); 97 99 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(); 100 105 } 101 106 … … 198 203 199 204 //for the first element of sortedObjectList_ / the closest waypoint show the Arrow3D 205 //set the direction of the arrow to the closest waypoint 200 206 if(!sortedObjectList_.empty()) 201 207 { 202 208 showArrow3D(); 203 209 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();} 210 219 211 220 … … 413 422 this->background_->addChild ( text ); 414 423 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 ) ); 416 430 417 431 -
code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.h
r9177 r9219 87 87 void hideArrow3D(); 88 88 89 orxonox::MovableEntity* arrowEntity; 90 89 91 bool showObject( RadarViewable* rv ); 90 92
Note: See TracChangeset
for help on using the changeset viewer.