Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc @ 11476

Last change on this file since 11476 was 11332, checked in by ooguz, 8 years ago

Last Commit (waypointscale ist 0)

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