Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/objects/SpaceshipSteeringObject.cc @ 538

Last change on this file since 538 was 519, checked in by nicolape, 17 years ago

Loading the steering works, but there is something odd with the steering object in orxonox.cc… it was defined global, i moved it to orxonox class and made it available with the singleton stuff.. it works for my loader and it compiles well, but when running the listener got a porblem with it and crashes. can someone take a look at id, thx

File size: 2.2 KB
RevLine 
[515]1#include <OgreSceneManager.h>
2#include <OgreSceneNode.h>
3#include <OgreRoot.h>
4#include <OgreRenderWindow.h>
5
6#include <string>
7
8#include "../orxonox.h"
9#include "../graphicsEngine.h"
10#include "../../tinyxml/tinyxml.h"
11#include "../../misc/Tokenizer.h"
12#include "../../misc/String2Number.h"
13
14#include "SpaceshipSteeringObject.h"
15
16#include "../spaceship_steering.h"
17
18namespace orxonox
19{
20    CreateFactory(SpaceshipSteeringObject);
21
22    SpaceshipSteeringObject::SpaceshipSteeringObject()
23    {
24        RegisterObject(SpaceshipSteeringObject);
25    }
26
27    SpaceshipSteeringObject::~SpaceshipSteeringObject()
28    {
29    }
30
31    void SpaceshipSteeringObject::loadParams(TiXmlElement* xmlElem)
32    {
33        SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();
34       
35        if (xmlElem->Attribute("node") && xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft"))
36        {
37                std::string nodeStr = xmlElem->Attribute("node");
38                std::string forwardStr = xmlElem->Attribute("forward");
39                std::string rotateupdownStr = xmlElem->Attribute("rotateupdown");
40                std::string rotaterightleftStr = xmlElem->Attribute("rotaterightleft");
41                std::string looprightleftStr = xmlElem->Attribute("looprightleft");
42
43                float forward, rotateupdown, rotaterightleft, looprightleft;
44                String2Number<float>(forward, forwardStr);
45                String2Number<float>(rotateupdown, rotateupdownStr);
46                String2Number<float>(rotaterightleft, rotaterightleftStr);
47                String2Number<float>(looprightleft, looprightleftStr);
48           
49                steering = new SpaceshipSteering(forward, rotateupdown, rotaterightleft, looprightleft);
50               
51                Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
52                    Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(nodeStr);
53                                       
54                steering->addNode(sceneNode);
55   
[519]56   
57   
58   
[515]59                std::cout << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl;
60        }       
61   }
62}
Note: See TracBrowser for help on using the repository browser.