Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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/orxonox/objects/worldentities
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • 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.