Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11307


Ignore:
Timestamp:
Nov 28, 2016, 3:34:58 PM (8 years ago)
Author:
ooguz
Message:

arrow points at the right location

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc

    r11298 r11307  
    1414        RegisterObject(Waypointarrow);
    1515        model = new Model(this->getContext());
    16         model->setMeshSource("cokebottle.mesh");  // Name of the arrow file for now bottle
     16        model->setMeshSource("arrow.mesh");  // Name of the arrow file for now bottle
    1717        this->attach(model);
    1818        model->setScale(3);
    1919       // model->setOrientation(Vector3(0,0,-1));
    20         model->setPosition(Vector3(0,15,0));
     20        model->setPosition(Vector3(0,15, 0));
    2121        waypoints_ = nullptr;
    22        
    2322    }
    2423
     
    2726    }
    2827
    29    /* 
     28   /*
    3029    Waypoint* WaypointGroup::getActive(){
    3130          for (Waypoint* object : this->waypoints_){
     
    3938
    4039    void tick::getActive
     40
     41
    4142*/
    4243
     
    4849            for (WaypointGroup* group : ObjectList<WaypointGroup>())
    4950                waypoints_ = group;
    50        
     51
    5152        }
    5253
     
    5859
    5960    void Waypointarrow::tick(float dt){
    60      
     61
    6162        if (getWaypointgroup() == nullptr){
    6263                    orxout() << "Second" << endl;
    6364
    6465            return;
    65         }     
    66                
     66        }
     67
    6768        waypoints_ = getWaypointgroup();
    68                
     69
    6970        waypoint = waypoints_->getActive();
    70                        
     71
    7172        Vector3 waypoint_position = waypoint->getWorldPosition();
     73
     74        Vector3 trial = waypoint_position - this->getWorldPosition();
     75
     76        //orxout() << "dsfsf" << waypoint_position.x << endl;
     77        orxout() << "waypoint " << waypoint_position.x <<  "waypoint " << waypoint_position.y << "waypoint " << waypoint_position.z << endl;
     78        orxout() << "model " << this->model->getWorldPosition().x <<  "model " << this->model->getWorldPosition().y << "model " << this->model->getWorldPosition().z << endl;
     79        orxout() << "this " << this->getWorldPosition().x <<  "this " << this->getWorldPosition().y << "this " << this->getWorldPosition().z << endl;
     80        orxout() << "trial " << trial.x <<  "trial " << trial.y << "trial " << trial.z << endl;
     81
     82        Vector3 origin = model->getWorldPosition();;
     83        model->setDirection( origin - waypoint_position, TransformSpace::World);
    7284     
    73         orxout() << "dsfsf" << waypoint_position.x << endl;
    74         model->lookAt(waypoint_position - this->getWorldPosition());
    7585
    76        
    7786    }
    7887
    7988    void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
    8089        SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
    81        
     90
    8291        //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3)
    8392
    8493        //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
    85  
     94
    8695
    8796    }
Note: See TracChangeset for help on using the changeset viewer.