Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1989


Ignore:
Timestamp:
Oct 21, 2008, 4:56:41 PM (16 years ago)
Author:
landauf
Message:
  • added ControllableEntity, the baseclass of all players, vehicles and ships.
  • moved Template to core
  • some changes in Camera
  • added 6 constants to WorldEntity to identify relative directions
  • changed vom Radian to Degree as default angle unit
Location:
code/branches/objecthierarchy/src
Files:
2 added
21 edited
2 moved

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/core/BaseObject.cc

    r1625 r1989  
    3737#include "XMLPort.h"
    3838#include "Level.h"
     39#include "Template.h"
    3940
    4041namespace orxonox
     
    7677        XMLPortParam(BaseObject, "visible", setVisible, isVisible, xmlelement, mode);
    7778        XMLPortParam(BaseObject, "active", setActive, isActive, xmlelement, mode);
     79
     80        XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, const std::string&);
    7881    }
    7982
     
    8689        return this->level_->getFile();
    8790    }
     91
     92    /**
     93        @brief Adds a Template to the object.
     94        @param name The name of the Template
     95    */
     96    void BaseObject::addTemplate(const std::string& name)
     97    {
     98        Template* temp = Template::getTemplate(name);
     99        if (temp)
     100            this->addTemplate(temp);
     101        else
     102            COUT(1) << "Error: \"" << name << "\" is not a valid Template name (in class: " << this->getIdentifier()->getName() << ", name: " << this->getName() << ")." << std::endl;
     103    }
     104
     105    /**
     106        @brief Adds a Template to the object.
     107        @param temp The Template
     108    */
     109    void BaseObject::addTemplate(Template* temp)
     110    {
     111        this->templates_.insert(temp);
     112        temp->applyOn(this);
     113    }
     114
     115    /**
     116        @brief Returns the Template with the given index.
     117        @param index The index
     118    */
     119    Template* BaseObject::getTemplate(unsigned int index) const
     120    {
     121        unsigned int i = 0;
     122        for (std::set<Template*>::const_iterator it = this->templates_.begin(); it != this->templates_.end(); ++it)
     123        {
     124            if (i == index)
     125                return (*it);
     126            i++;
     127        }
     128        return 0;
     129    }
    88130}
  • code/branches/objecthierarchy/src/core/BaseObject.h

    r1950 r1989  
    8787            const std::string& getLevelfile() const;
    8888
     89            void addTemplate(const std::string& name);
     90            void addTemplate(Template* temp);
     91            /** @brief Returns the set of all aplied templates. */
     92            inline const std::set<Template*>& getTemplates() const
     93                { return this->templates_; }
     94
    8995            virtual inline void setNamespace(Namespace* ns) { this->namespace_ = ns; }
    9096            inline Namespace* getNamespace() const { return this->namespace_; }
     
    102108
    103109        private:
     110            Template* getTemplate(unsigned int index) const;
     111
    104112            bool bInitialized_;                         //!< True if the object was initialized (passed the object registration)
    105113            const Level* level_;                        //!< The level that loaded this object
    106114            std::string loaderIndentation_;             //!< Indentation of the debug output in the Loader
    107115            Namespace* namespace_;
     116            std::set<Template*> templates_;
    108117    };
    109118
  • code/branches/objecthierarchy/src/core/CMakeLists.txt

    r1961 r1989  
    3131  Namespace.cc
    3232  NamespaceNode.cc
     33  Template.cc
    3334  XMLPort.cc
    3435
  • code/branches/objecthierarchy/src/core/CorePrereqs.h

    r1757 r1989  
    153153  struct TclInterpreterBundle;
    154154  class TclThreadManager;
     155  class Template;
    155156  class Tickable;
    156157  template <class T, class O>
  • code/branches/objecthierarchy/src/core/Template.cc

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/ceguilua/src/orxonox/objects/Template.cc1802-1808
      /code/branches/core3/src/orxonox/objects/Template.cc1572-1739
      /code/branches/gcc43/src/orxonox/objects/Template.cc1580
      /code/branches/gui/src/orxonox/objects/Template.cc1635-1723
      /code/branches/input/src/orxonox/objects/Template.cc1629-1636
      /code/branches/script_trigger/src/orxonox/objects/Template.cc1295-1953,​1955
    r1971 r1989  
    4949    Template::~Template()
    5050    {
     51        Template::getTemplateMap().erase(this->getName());
    5152    }
    5253
     
    5960
    6061        this->setXMLElement(*xmlelement.FirstChildElement(false));
     62    }
     63
     64    void Template::changedName()
     65    {
     66        if (this->getName() != "")
     67        {
     68            std::map<std::string, Template*>::iterator it;
     69            it = Template::getTemplateMap().find(this->getOldName());
     70            if (it != Template::getTemplateMap().end())
     71                Template::getTemplateMap().erase(it);
     72
     73            it = Template::getTemplateMap().find(this->getName());
     74            if (it != Template::getTemplateMap().end())
     75                COUT(2) << "Warning: Template with name \"" << this->getName() << "\" already exists." << std::endl;
     76            else
     77                Template::getTemplateMap()[this->getName()] = this;
     78        }
    6179    }
    6280
  • code/branches/objecthierarchy/src/core/Template.h

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/ceguilua/src/orxonox/objects/Template.h1802-1808
      /code/branches/core3/src/orxonox/objects/Template.h1572-1739
      /code/branches/gcc43/src/orxonox/objects/Template.h1580
      /code/branches/gui/src/orxonox/objects/Template.h1635-1723
      /code/branches/input/src/orxonox/objects/Template.h1629-1636
      /code/branches/script_trigger/src/orxonox/objects/Template.h1295-1953,​1955
    r1971 r1989  
    3232#include <map>
    3333
    34 #include "OrxonoxPrereqs.h"
    35 #include "core/BaseObject.h"
     34#include "CorePrereqs.h"
     35
     36#include "BaseObject.h"
    3637#include "tinyxml/ticpp.h"
    3738
    3839namespace orxonox
    3940{
    40     class _OrxonoxExport Template : public BaseObject
     41    class _CoreExport Template : public BaseObject
    4142    {
    4243        public:
     
    4546
    4647            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     48            virtual void changedName();
    4749
    4850            inline void setLink(const std::string& link)
  • code/branches/objecthierarchy/src/core/XMLPort.h

    r1940 r1989  
    219219*/
    220220#define XMLPortObjectExtendedTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \
    221     XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
     221    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
    222222
    223223// -------------
     
    233233*/
    234234#define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, ...) \
    235     XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true)
     235    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true)
    236236
    237237// --------------------
  • code/branches/objecthierarchy/src/network/Synchronisable.cc

    r1945 r1989  
    8181      for(std::list<synchronisableVariable *>::iterator it = syncList->begin(); it!=syncList->end(); it++)
    8282        delete (*it)->callback;
    83       deletedObjects_.push(objectID);
     83      if (this->objectMode_ != 0x0)
     84        deletedObjects_.push(objectID);
    8485//       COUT(3) << "destruct synchronisable +++" << objectID << " | " << classID << std::endl;
    8586//       COUT(3) << " bump ---" << objectID << " | " << &objectMap_ << std::endl;
     
    418419   */
    419420  void Synchronisable::setObjectMode(int mode){
    420     assert(mode==0x1 || mode==0x2 || mode==0x3);
     421    assert(mode==0x0 || mode==0x1 || mode==0x2 || mode==0x3);
    421422    objectMode_=mode;
    422423  }
  • code/branches/objecthierarchy/src/network/Synchronisable.h

    r1945 r1989  
    4848namespace network
    4949{
     50  static const unsigned int OBJECTID_UNKNOWN = (unsigned int)-1;
     51
    5052  namespace direction{
    5153    enum syncdirection{
  • code/branches/objecthierarchy/src/orxonox/CMakeLists.txt

    r1970 r1989  
    4343  tools/WindowEventListener.cc
    4444
    45   objects/Template.cc
    46 
    4745  objects/worldentities/WorldEntity.cc
    4846  objects/worldentities/PositionableEntity.cc
    4947  objects/worldentities/MovableEntity.cc
     48  objects/worldentities/ControllableEntity.cc
    5049#  objects/Backlight.cc
    5150  objects/Camera.cc
  • code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h

    r1970 r1989  
    8181
    8282    // objects
    83     class Template;
    84 
    8583    class WorldEntity;
    8684    class PositionableEntity;
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSStandalone.cc

    r1949 r1989  
    4949        GSLevel::enter();
    5050
     51        Core::setIsStandalone(true);
    5152        this->loadLevel();
    5253
     
    5859        // level is loaded: we can start capturing the input
    5960        InputManager::getInstance().requestEnterState("game");
    60 
    61         Core::setIsStandalone(true);
    6261    }
    6362
  • code/branches/objecthierarchy/src/orxonox/objects/Camera.cc

    r1911 r1989  
    4747namespace orxonox
    4848{
     49  Camera::Camera()
     50  {
     51    RegisterObject(Camera);
    4952
    50   Camera::Camera(Ogre::SceneNode* node)
    51   {
    5253    this->bHasFocus_ = false;
    53     this->cameraNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(node->getName() + "Camera");
    54     if( node != NULL )
    55       this->setPositionNode(node);
     54    this->bDrag_ = false;
     55    this->cameraNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode();
     56    this->setObjectMode(0x0);
    5657  }
    5758
    5859  Camera::~Camera()
    5960  {
    60     CameraHandler::getInstance()->releaseFocus(this);
    61     GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeAndDestroyChild(cameraNode_->getName());
    62   }
    63 
    64   void Camera::setPositionNode(Ogre::SceneNode* node)
    65   {
    66     this->positionNode_ = node;
    67     // set camera to node values according to camera mode
    68   }
    69 
    70   void Camera::setTargetNode(Ogre::SceneNode* obj)
    71   {
    72     this->targetNode_ = obj;
     61    if (this->isInitialized())
     62    {
     63      CameraHandler::getInstance()->releaseFocus(this);
     64      GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeAndDestroyChild(this->cameraNode_->getName());
     65    }
    7366  }
    7467
    7568  void Camera::tick(float dt)
    7669  {
    77     if (this->positionNode_ != NULL)
    78     {
    7970      // this stuff here may need some adjustments
    80       Vector3 offset = this->positionNode_->getWorldPosition() - this->cameraNode_->getWorldPosition();
    81       float coeff = 15.0f * dt;
    82       if (coeff > 1.0f)
    83         coeff = 1.0f;
     71      float coeff = (this->bDrag_) ? min(1.0f, 15.0f * dt) : (1.0f);
    8472
     73      Vector3 offset = this->getNode()->getWorldPosition() - this->cameraNode_->getWorldPosition();
    8574      this->cameraNode_->translate(coeff * offset);
    8675
    87       this->cameraNode_->setOrientation(Quaternion::Slerp(1-coeff, this->positionNode_->getWorldOrientation(), this->cameraNode_->getWorldOrientation(), false));
    88     }
     76      this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->getWorldOrientation(), this->getWorldOrientation(), false));
    8977  }
    9078
     
    9583  void Camera::update()
    9684  {
    97     if(this->positionNode_ != NULL)
    98     {
    99       this->cameraNode_->setPosition(this->positionNode_->getWorldPosition());
    100       this->cameraNode_->setOrientation(this->positionNode_->getWorldOrientation());
    101     }
     85      this->cameraNode_->setPosition(this->getWorldPosition());
     86      this->cameraNode_->setOrientation(this->getWorldOrientation());
    10287  }
    10388
     
    119104    this->cameraNode_->attachObject(this->cam_);
    120105  }
     106
     107  void Camera::requestFocus()
     108  {
     109    CameraHandler::getInstance()->requestFocus(this);
     110  }
    121111}
  • code/branches/objecthierarchy/src/orxonox/objects/Camera.h

    r1505 r1989  
    3535
    3636#include "OrxonoxPrereqs.h"
     37#include "objects/worldentities/PositionableEntity.h"
    3738
    3839namespace orxonox
    3940{
    40     class _OrxonoxExport Camera
     41    class _OrxonoxExport Camera : public PositionableEntity
    4142    {
    4243      friend class CameraHandler;
    4344      public:
    44         Camera(Ogre::SceneNode* node = NULL);
     45        Camera();
    4546        virtual ~Camera();
    46 
    47         void setPositionNode(Ogre::SceneNode* node);
    48         inline Ogre::SceneNode* getCameraNode() { return this->positionNode_; }
    49         // maybe also BaseObject
    50         void setTargetNode(Ogre::SceneNode* obj);
    51 
    52         Ogre::Camera* cam_;
    5347
    5448        void tick(float dt);
    5549        void update();
    56         inline bool hasFocus() { return this->bHasFocus_; }
     50
     51        void requestFocus();
     52        inline bool hasFocus()
     53            { return this->bHasFocus_; }
     54
     55        inline void setDrag(bool bDrag)
     56            { this->bDrag_ = bDrag; }
     57        inline bool getDrag() const
     58            { return this->bDrag_; }
    5759
    5860      private:
     
    6062        void setFocus(Ogre::Camera* ogreCam);
    6163
    62       private:
    63         Ogre::SceneNode* targetNode_;
    64         Ogre::SceneNode* positionNode_;
     64        Ogre::Camera* cam_;
    6565        Ogre::SceneNode* cameraNode_;
    6666        Ogre::Vector3 oldPos;
    6767        bool bHasFocus_;
     68        bool bDrag_;
    6869    };
    6970}
  • code/branches/objecthierarchy/src/orxonox/objects/gametypes/Gametype.cc

    r1953 r1989  
    122122        this->players_.insert(player);
    123123        this->playerJoined(player);
     124
     125        ControllableEntity* newpawn = this->defaultPawn_.fabricate();
     126        player->startControl(newpawn);
    124127    }
    125128
    126129    void Gametype::removePlayer(PlayerInfo* player)
    127130    {
     131        player->stopControl();
    128132        this->players_.erase(player);
    129133        this->playerLeft(player);
  • code/branches/objecthierarchy/src/orxonox/objects/gametypes/Gametype.h

    r1953 r1989  
    3535
    3636#include "core/BaseObject.h"
     37#include "core/Identifier.h"
    3738#include "network/ClientConnectionListener.h"
     39#include "objects/worldentities/ControllableEntity.h"
    3840
    3941namespace orxonox
     
    7173            std::set<PlayerInfo*> players_;
    7274            std::map<unsigned int, PlayerInfo*> clients_;
     75            SubclassIdentifier<ControllableEntity> defaultPawn_;
    7376    };
    7477}
  • code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc

    r1953 r1989  
    4141#include "GraphicsEngine.h"
    4242#include "objects/gametypes/Gametype.h"
     43#include "objects/worldentities/ControllableEntity.h"
    4344
    4445namespace orxonox
     
    5657        this->bHumanPlayer_ = false;
    5758        this->bFinishedSetup_ = false;
     59
     60        this->pawn_ = 0;
     61        this->pawnID_ = network::OBJECTID_UNKNOWN;
    5862
    5963        this->setConfigValues();
     
    103107        REGISTERDATA(ping_,           network::direction::toclient);
    104108        REGISTERDATA(bHumanPlayer_,   network::direction::toclient);
     109        REGISTERDATA(pawnID_,         network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::updatePawn));
    105110        REGISTERDATA(bFinishedSetup_, network::direction::bidirectional, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::finishedSetup));
    106111    }
     
    160165        }
    161166    }
     167
     168    void PlayerInfo::startControl(ControllableEntity* pawn)
     169    {
     170        pawn->setPlayer(this);
     171        this->pawn_ = pawn;
     172        this->pawnID_ = pawn->getObjectID();
     173    }
     174
     175    void PlayerInfo::stopControl()
     176    {
     177        this->pawn_->removePlayer();
     178        this->pawn_ = 0;
     179        this->pawnID_ = network::OBJECTID_UNKNOWN;
     180    }
     181
     182    void PlayerInfo::updatePawn()
     183    {
     184        this->pawn_ = dynamic_cast<ControllableEntity*>(network::Synchronisable::getSynchronisable(this->pawnID_));
     185        if (this->pawn_ && (this->pawn_->getPlayer() != this))
     186            this->pawn_->setPlayer(this);
     187    }
    162188}
  • code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h

    r1953 r1989  
    5252                { return this->clientID_; }
    5353
    54             inline void setHumanPlayer(bool bHumanPlayer)
    55                 { this->bHumanPlayer_ = bHumanPlayer; }
    5654            inline bool isHumanPlayer() const
    5755                { return this->bHumanPlayer_; }
     56
     57            inline bool isLocalPlayer() const
     58                { return this->bLocalPlayer_; }
     59
     60            void startControl(ControllableEntity* pawn);
     61            void stopControl();
     62
     63            inline ControllableEntity* getPawn() const
     64                { return this->pawn_; }
    5865
    5966        private:
     
    6269            void checkNick();
    6370            void clientChangedName();
     71            void updatePawn();
    6472
    6573            unsigned int clientID_;
     
    7179            std::string playerName_;
    7280            std::string nick_;
     81
     82            ControllableEntity* pawn_;
     83            unsigned int pawnID_;
    7384    };
    7485}
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/MovableEntity.cc

    r1968 r1989  
    4444        RegisterObject(MovableEntity);
    4545
     46        this->velocity_ = Vector3::ZERO;
     47        this->acceleration_ = Vector3::ZERO;
     48        this->rotationAxis_ = Vector3::ZERO;
     49        this->rotationRate_ = 0;
     50        this->momentum_ = 0;
     51
     52        this->overwrite_position_ = Vector3::ZERO;
     53        this->overwrite_orientation_ = Quaternion::IDENTITY;
     54
    4655        this->registerVariables();
    4756    }
     
    5766        XMLPortParamTemplate(MovableEntity, "velocity", setVelocity, getVelocity, xmlelement, mode, const Vector3&);
    5867        XMLPortParamTemplate(MovableEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
    59         XMLPortParamTemplate(MovableEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Radian&);
     68        XMLPortParamTemplate(MovableEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Degree&);
    6069    }
    6170
     
    139148    }
    140149
    141     void MovableEntity::yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo)
     150    void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    142151    {
    143152        this->node_->yaw(angle, relativeTo);
     
    145154    }
    146155
    147     void MovableEntity::pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo)
     156    void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    148157    {
    149158        this->node_->pitch(angle, relativeTo);
     
    151160    }
    152161
    153     void MovableEntity::roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo)
     162    void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    154163    {
    155164        this->node_->roll(angle, relativeTo);
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/MovableEntity.h

    r1968 r1989  
    5959            void setOrientation(const Quaternion& orientation);
    6060            void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    61             void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    62             void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    63             void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
     61            void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
     62            void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
     63            void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    6464            void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    6565            void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
     
    8686                { return this->rotationAxis_; }
    8787
     88            inline void setRotationRate(const Degree& angle)
     89                { this->rotationRate_ = angle; }
    8890            inline void setRotationRate(const Radian& angle)
    8991                { this->rotationRate_ = angle; }
    90             inline void setRotationRate(const Degree& angle)
    91                 { this->rotationRate_ = angle; }
    92             inline const Radian& getRotationRate() const
     92            inline const Degree& getRotationRate() const
    9393                { return this->rotationRate_; }
    9494
     95            inline void setMomentum(const Degree& angle)
     96                { this->momentum_ = angle; }
    9597            inline void setMomentum(const Radian& angle)
    9698                { this->momentum_ = angle; }
    97             inline void setMomentum(const Degree& angle)
    98                 { this->momentum_ = angle; }
    99             inline const Radian& getMomentum() const
     99            inline const Degree& getMomentum() const
    100100                { return this->momentum_; }
    101101
     
    111111            Vector3 acceleration_;
    112112            Vector3 rotationAxis_;
    113             Radian rotationRate_;
    114             Radian momentum_;
     113            Degree rotationRate_;
     114            Degree momentum_;
    115115
    116116            Vector3 overwrite_position_;
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/PositionableEntity.h

    r1968 r1989  
    5858            inline void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
    5959                { this->node_->rotate(rotation, relativeTo); }
    60             inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
     60            inline void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
    6161                { this->node_->yaw(angle, relativeTo); }
    62             inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
     62            inline void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
    6363                { this->node_->pitch(angle, relativeTo); }
    64             inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
     64            inline void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
    6565                { this->node_->roll(angle, relativeTo); }
    6666            inline void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.cc

    r1948 r1989  
    3939namespace orxonox
    4040{
     41    const Vector3 WorldEntity::FRONT = Vector3::NEGATIVE_UNIT_Z;
     42    const Vector3 WorldEntity::BACK  = Vector3::UNIT_Z;
     43    const Vector3 WorldEntity::LEFT  = Vector3::NEGATIVE_UNIT_X;
     44    const Vector3 WorldEntity::RIGHT = Vector3::UNIT_X;
     45    const Vector3 WorldEntity::DOWN  = Vector3::NEGATIVE_UNIT_Y;
     46    const Vector3 WorldEntity::UP    = Vector3::UNIT_Y;
     47
    4148    WorldEntity::WorldEntity()
    4249    {
     
    4653        this->parent_ = 0;
    4754        this->parentID_ = (unsigned int)-1;
     55
     56        this->node_->setPosition(Vector3::ZERO);
     57        this->node_->setOrientation(Quaternion::IDENTITY);
    4858
    4959        this->registerVariables();
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.h

    r1940 r1989  
    5454                { return this->node_; }
    5555
     56            static const Vector3 FRONT;
     57            static const Vector3 BACK;
     58            static const Vector3 LEFT;
     59            static const Vector3 RIGHT;
     60            static const Vector3 DOWN;
     61            static const Vector3 UP;
     62
    5663            virtual void setPosition(const Vector3& position) = 0;
    5764            inline void setPosition(float x, float y, float z)
     
    7178            inline void setOrientation(const Vector3& axis, const Radian& angle)
    7279                { this->setOrientation(Quaternion(angle, axis)); }
     80            inline void setOrientation(const Vector3& axis, const Degree& angle)
     81                { this->setOrientation(Quaternion(angle, axis)); }
    7382            inline const Quaternion& getOrientation() const
    7483                { return this->node_->getOrientation(); }
     
    7786
    7887            virtual void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
     88            inline void rotate(const Vector3& axis, const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
     89                { this->rotate(Quaternion(angle, axis), relativeTo); }
    7990            inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
    8091                { this->rotate(Quaternion(angle, axis), relativeTo); }
    8192
    82             virtual void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
    83             virtual void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
    84             virtual void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
     93            virtual void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
     94            inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
     95                { this->yaw(Degree(angle), relativeTo); }
     96            virtual void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
     97            inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
     98                { this->pitch(Degree(angle), relativeTo); }
     99            virtual void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
     100            inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
     101                { this->roll(Degree(angle), relativeTo); }
    85102
    86103            virtual void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0;
     
    131148            inline void setDirection_xmlport(const Vector3& direction)
    132149                { this->setDirection(direction); }
    133             inline void yaw_xmlport(const Radian& angle)
     150            inline void yaw_xmlport(const Degree& angle)
    134151                { this->yaw(angle); }
    135             inline void pitch_xmlport(const Radian& angle)
     152            inline void pitch_xmlport(const Degree& angle)
    136153                { this->pitch(angle); }
    137             inline void roll_xmlport(const Radian& angle)
     154            inline void roll_xmlport(const Degree& angle)
    138155                { this->roll(angle); }
    139156
Note: See TracChangeset for help on using the changeset viewer.