Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2011, 11:40:58 PM (13 years ago)
Author:
dafrick
Message:

Merging pickup branch into presentation branch.

Location:
code/branches/presentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/modules/objects/collisionshapes/BoxCollisionShape.h

    r7601 r8556  
    4343namespace orxonox
    4444{
     45
     46    /**
     47    @brief
     48        Wrapper for the bullet box collision shape class btBoxShape.
     49
     50    @author
     51        Reto Grieder
     52
     53    @see btBoxShape
     54    @ingroup Collisionshapes
     55    */
    4556    class _ObjectsExport BoxCollisionShape : public CollisionShape
    4657    {
     
    5162            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5263
    53             inline void setHalfExtents(const Vector3& extents)
    54                 { this->halfExtents_ = extents; updateShape(); }
     64            /**
     65            @brief Set the half extents of the BoxCollisionShape.
     66                   If the half extent changes, this causes the internal collision shape to be recreated.
     67            @param extents A vector with the half extents.
     68                   The x-component is half the length, the y-component is half the height and the z-component is half the width.
     69            @return Returns true if the half extent has changed, false if not.
     70            */
     71            inline bool setHalfExtents(const Vector3& extents)
     72                { if(this->halfExtents_ == extents) return false; this->halfExtents_ = extents; updateShape(); return true; }
     73            /**
     74            @brief Get the half extents of the BoxCollisionShape.
     75            @return Returns a vector containing the half extents.
     76            */
    5577            inline const Vector3& getHalfExtents() const
    5678                { return halfExtents_;}
    5779
    58             inline void setWidth(float value)
    59                 { this->halfExtents_.z = value / 2; updateShape(); }
     80            /**
     81            @brief Set the width of the BoxCollisionShape.
     82                   If the width changes, this causes the internal collision shape to be recreated.
     83            @param value The width to be set.
     84            @return Returns true if the width has changed, false if not.
     85            */
     86            inline bool setWidth(float value)
     87                { if(this->halfExtents_.z == value/2.0f) return false; this->halfExtents_.z = value / 2.0f; updateShape(); return true; }
     88            /**
     89            @brief Get the width of the BoxCollisionShape.
     90            @return Returns the width of the BoxCollisionShape.
     91            */
    6092            inline float getWidth() const
    61                 { return this->halfExtents_.z * 2; }
     93                { return this->halfExtents_.z * 2.0f; }
    6294
    63             inline void setHeight(float value)
    64                 { this->halfExtents_.y = value / 2; updateShape(); }
     95            /**
     96            @brief Set the height of the BoxCollisionShape.
     97                   If the height changes, this causes the internal collision shape to be recreated.
     98            @param value The height to be set.
     99            @return Returns true if the height has changed, false if not.
     100            */
     101            inline bool setHeight(float value)
     102                { if(this->halfExtents_.y == value/2.0f) return false; this->halfExtents_.y = value / 2.0f; updateShape(); return true; }
     103            /**
     104            @brief Get the height of the BoxCollisionShape.
     105            @return Returns the height of the BoxCollisionShape.
     106            */
    65107            inline float getHeight() const
    66                 { return this->halfExtents_.y * 2; }
     108                { return this->halfExtents_.y * 2.0f; }
    67109
    68             inline void setLength(float value)
    69                 { this->halfExtents_.x = value / 2; updateShape(); }
     110            /**
     111            @brief Set the length of the BoxCollisionShape.
     112                   If the length changes, this causes the internal collision shape to be recreated.
     113            @param value The length to be set.
     114            @return Returns true if the length has changed, false if not.
     115            */
     116            inline bool setLength(float value)
     117                { if(this->halfExtents_.x == value/2.0f) return false; this->halfExtents_.x = value / 2.0f; updateShape(); return true; }
     118            /**
     119            @brief Get the length of the BoxCollisionShape.
     120            @return Returns the length of the BoxCollisionShape.
     121            */
    70122            inline float getLength() const
    71                 { return this->halfExtents_.x * 2; }
     123                { return this->halfExtents_.x * 2.0f; }
     124
     125            virtual void changedScale(); // Is called when the scale of the BoxCollisionShape has changed.
    72126
    73127        private:
    74128            void registerVariables();
    75129
    76             btCollisionShape* createNewShape() const;
     130            btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the BoxCollisionShape.
    77131
    78             Vector3 halfExtents_;
     132            Vector3 halfExtents_; //!< The half extents of the BoxCollisionShape. The x-component is half the length, the y-component is half the height and the z-component is half the width.
    79133     };
    80134}
Note: See TracChangeset for help on using the changeset viewer.