[Orxonox-commit 6677] r11307 - code/branches/QuestGuide_HS16/src/modules/waypoints

ooguz at orxonox.net ooguz at orxonox.net
Mon Nov 28 15:34:58 CET 2016


Author: ooguz
Date: 2016-11-28 15:34:58 +0100 (Mon, 28 Nov 2016)
New Revision: 11307

Modified:
   code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
Log:
arrow points at the right location

Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc	2016-11-28 12:20:42 UTC (rev 11306)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc	2016-11-28 14:34:58 UTC (rev 11307)
@@ -13,20 +13,19 @@
     {
         RegisterObject(Waypointarrow);
         model = new Model(this->getContext());
-        model->setMeshSource("cokebottle.mesh");  // Name of the arrow file for now bottle
+        model->setMeshSource("arrow.mesh");  // Name of the arrow file for now bottle
         this->attach(model);
         model->setScale(3);
        // model->setOrientation(Vector3(0,0,-1));
-        model->setPosition(Vector3(0,15,0));
+        model->setPosition(Vector3(0,15, 0));
         waypoints_ = nullptr;
-        
     }
 
     Waypointarrow::~Waypointarrow()
     {
     }
 
-   /*  
+   /*
     Waypoint* WaypointGroup::getActive(){
           for (Waypoint* object : this->waypoints_){
             if(!(object->waypoint_actived)){
@@ -38,6 +37,8 @@
 
 
     void tick::getActive
+
+
 */
 
 
@@ -47,7 +48,7 @@
 
             for (WaypointGroup* group : ObjectList<WaypointGroup>())
                 waypoints_ = group;
-        
+
         }
 
         return waypoints_;
@@ -57,33 +58,41 @@
 
 
     void Waypointarrow::tick(float dt){
-     
+
         if (getWaypointgroup() == nullptr){
                     orxout() << "Second" << endl;
 
             return;
-        }     
-               
+        }
+
         waypoints_ = getWaypointgroup();
-               
+
         waypoint = waypoints_->getActive();
-                       
+
         Vector3 waypoint_position = waypoint->getWorldPosition();
+
+        Vector3 trial = waypoint_position - this->getWorldPosition();
+
+        //orxout() << "dsfsf" << waypoint_position.x << endl;
+        orxout() << "waypoint " << waypoint_position.x <<  "waypoint " << waypoint_position.y << "waypoint " << waypoint_position.z << endl;
+        orxout() << "model " << this->model->getWorldPosition().x <<  "model " << this->model->getWorldPosition().y << "model " << this->model->getWorldPosition().z << endl;
+        orxout() << "this " << this->getWorldPosition().x <<  "this " << this->getWorldPosition().y << "this " << this->getWorldPosition().z << endl;
+        orxout() << "trial " << trial.x <<  "trial " << trial.y << "trial " << trial.z << endl;
+
+        Vector3 origin = model->getWorldPosition();;
+        model->setDirection( origin - waypoint_position, TransformSpace::World);
      
-        orxout() << "dsfsf" << waypoint_position.x << endl;
-        model->lookAt(waypoint_position - this->getWorldPosition());
 
-        
     }
 
     void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
         SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
-        
+
         //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3)
 
         //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
- 
 
+
     }
 
 




More information about the Orxonox-commit mailing list