Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc @ 11309

Last change on this file since 11309 was 11309, checked in by ooguz, 7 years ago

Distance Trigger base methods

File size: 2.7 KB
Line 
1#include "Waypointarrow.h"
2
3#include <OgreSceneNode.h>
4#include <BulletDynamics/Dynamics/btRigidBody.h>
5#include "util/OrxAssert.h"
6#include "core/CoreIncludes.h"
7
8namespace orxonox
9{
10    RegisterClass(Waypointarrow);
11
12    Waypointarrow::Waypointarrow(Context* context) : StaticEntity(context)
13    {
14        RegisterObject(Waypointarrow);
15        model = new Model(this->getContext());
16        model->setMeshSource("arrow.mesh");  // Name of the arrow file for now bottle
17        this->attach(model);
18        model->setScale(3);
19       // model->setOrientation(Vector3(0,0,-1));
20        model->setPosition(Vector3(0,15, 0));
21        waypoints_ = nullptr;
22    }
23
24    Waypointarrow::~Waypointarrow()
25    {
26    }
27
28   /*
29    Waypoint* WaypointGroup::getActive(){
30          for (Waypoint* object : this->waypoints_){
31            if(!(object->waypoint_actived)){
32                object->enable_waypoint();
33                return object;
34            }
35        }
36    }
37
38
39    void tick::getActive
40
41
42*/
43
44
45    WaypointGroup* Waypointarrow::getWaypointgroup()
46    {
47        if (waypoints_ == nullptr){
48
49            for (WaypointGroup* group : ObjectList<WaypointGroup>())
50                waypoints_ = group;
51
52        }
53
54        return waypoints_;
55    }
56
57
58
59
60    void Waypointarrow::tick(float dt){
61
62        if (getWaypointgroup() == nullptr){
63                  orxout() << "Second" << endl;
64
65            return;
66        }
67
68        waypoints_ = getWaypointgroup();
69
70        waypoint = waypoints_->getActive();
71
72        Vector3 waypoint_position = waypoint->getWorldPosition();
73
74
75        //orxout() << "dsfsf" << waypoint_position.x << endl;
76    //    orxout() << "waypoint " << waypoint_position.x <<  "waypoint " << waypoint_position.y << "waypoint " << waypoint_position.z << endl;
77      //  orxout() << "model " << this->model->getWorldPosition().x <<  "model " << this->model->getWorldPosition().y << "model " << this->model->getWorldPosition().z << endl;
78      //  orxout() << "this " << this->getWorldPosition().x <<  "this " << this->getWorldPosition().y << "this " << this->getWorldPosition().z << endl;
79       // orxout() << "trial " << trial.x <<  "trial " << trial.y << "trial " << trial.z << endl;
80
81
82        Vector3 origin = model->getWorldPosition();;
83        model->setDirection( origin - waypoint_position, TransformSpace::World);
84     
85
86    }
87
88    void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
89        SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
90
91        //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3)
92
93        //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
94
95
96    }
97
98
99}
Note: See TracBrowser for help on using the repository browser.