Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Arrow movessvn add Waypoint.h!

File size: 2.2 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("cokebottle.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
25    Waypointarrow::~Waypointarrow()
26    {
27    }
28
29   /* 
30    Waypoint* WaypointGroup::getActive(){
31          for (Waypoint* object : this->waypoints_){
32            if(!(object->waypoint_actived)){
33                object->enable_waypoint();
34                return object;
35            }
36        }
37    }
38
39
40    void tick::getActive
41*/
42
43
44    WaypointGroup* Waypointarrow::getWaypointgroup()
45    {
46        if (waypoints_ == nullptr){
47
48            for (WaypointGroup* group : ObjectList<WaypointGroup>())
49                waypoints_ = group;
50       
51        }
52
53        return waypoints_;
54    }
55
56
57
58
59    void Waypointarrow::tick(float dt){
60     
61        if (getWaypointgroup() == nullptr){
62                    orxout() << "Second" << endl;
63
64            return;
65        }     
66               
67        waypoints_ = getWaypointgroup();
68               
69        waypoint = waypoints_->getActive();
70                       
71        Vector3 waypoint_position = waypoint->getWorldPosition();
72     
73        orxout() << "dsfsf" << waypoint_position.x << endl;
74        model->lookAt(waypoint_position - this->getWorldPosition());
75
76       
77    }
78
79    void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
80        SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
81       
82        //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3)
83
84        //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
85 
86
87    }
88
89
90}
Note: See TracBrowser for help on using the repository browser.