Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 580


Ignore:
Timestamp:
Dec 17, 2007, 4:27:41 PM (17 years ago)
Author:
rgrieder
Message:
  • fixed the problem about the ship being static.
  • added SceneNode hierarchy support in parser
Location:
code/branches/FICN
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/bin/levels/sample.oxw

    r579 r580  
    2626                <Skybox src="Orxonox/StarfieldSkyBox" />
    2727
    28                 <BaseEntity name="ASSF" src="assf2.mesh" node="OgreHeadNode" />
    29 
     28    <SceneNode name="ShipNode" pos="0,0,0" node="OgreHeadNode" scale="10,10,10" yaw="-90" pitch="-90" />
     29    <BaseEntity name="TheShip" src="assf2.mesh" node="ShipNode" />
    3030
    3131    <SceneNode name="node1" pos="0,200,0" />
  • code/branches/FICN/src/orxonox/objects/BaseEntity.cc

    r567 r580  
    3131        mesh_ = xmlElem->Attribute("src");
    3232        std::string node = xmlElem->Attribute("node");
     33
     34        // get the node
     35        this->setNode(Orxonox::getSingleton()->getSceneManager()->getSceneNode(node));
     36
    3337       
    3438        // register variables to be synchronised
     
    5458     Ogre::Entity* entity = mgr->createEntity(name_, mesh_);
    5559     
    56      Ogre::MovableObject *ent = (Ogre::MovableObject *)entity;
    57      getNode()->attachObject(ent); // big problem here: sigsegv
     60     //Ogre::MovableObject *ent = (Ogre::MovableObject *)entity;
     61     getNode()->attachObject(entity); // big problem here: sigsegv
    5862     return true;
    5963   }
  • code/branches/FICN/src/orxonox/objects/SceneNode.cc

    r560 r580  
    3737                String2Number<float>(z, pos[2]);
    3838
     39        float sx = 1, sy = 1, sz = 1;
     40        if (xmlElem->Attribute("scale"))
     41        {
     42                  pos = tokenize(xmlElem->Attribute("scale"),",");
     43                  String2Number<float>(sx, pos[0]);
     44                  String2Number<float>(sy, pos[1]);
     45                  String2Number<float>(sz, pos[2]);
     46        }
    3947
    40                 mgr->getRootSceneNode()->createChildSceneNode(name, Vector3(x,y,z));
     48        float yaw = 0.0;
     49        if (xmlElem->Attribute("yaw"))
     50        {
     51          String2Number<float>(yaw,xmlElem->Attribute("yaw"));
     52        }
     53        float pitch = 0.0;
     54        if (xmlElem->Attribute("pitch"))
     55        {
     56          String2Number<float>(pitch,xmlElem->Attribute("pitch"));
     57        }
     58        float roll = 0.0;
     59        if (xmlElem->Attribute("roll"))
     60        {
     61          String2Number<float>(roll,xmlElem->Attribute("roll"));
     62        }
     63
     64        Ogre::SceneNode *parentNode;
     65        if (xmlElem->Attribute("node"))
     66          parentNode = mgr->getSceneNode(xmlElem->Attribute("node"));
     67        else
     68          parentNode = mgr->getRootSceneNode();
     69
     70        Ogre::SceneNode* node = parentNode->createChildSceneNode(name, Vector3(x,y,z));
     71        node->scale(sx,sy,sz);
     72        node->yaw(Ogre::Degree(yaw));
     73        node->pitch(Ogre::Degree(pitch));
     74        node->roll(Ogre::Degree(roll));
    4175
    4276                COUT(4) << "Loader: Created node "<< name <<" : "<<x<<" " << y << " " << z  << std::endl << std::endl;
  • code/branches/FICN/src/orxonox/objects/WorldEntity.cc

    r576 r580  
    5050            name << (WorldEntity::worldEntityCounter_s++);
    5151            this->setName("WorldEntity" + name.str());
    52             node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
     52            // don't set the node yet!
     53            //node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
    5354            std::cout << "blubbbi: " << this->getName() << " .. " << this->node_ << std::endl;
    5455        }
  • code/branches/FICN/src/orxonox/objects/WorldEntity.h

    r576 r580  
    2222      inline Ogre::SceneNode* getNode()
    2323          { return this->node_; }
     24
     25      inline void setNode(Ogre::SceneNode* node)
     26          { this->node_ = node; }
    2427
    2528      inline void setPosition(const Vector3& pos)
Note: See TracChangeset for help on using the changeset viewer.