Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ogre1.9/src/modules/objects/collisionshapes/AbstractRadiusHeightCollisionShape.h @ 12141

Last change on this file since 12141 was 10189, checked in by landauf, 10 years ago

added new collision shape (cylinder)

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *   Co-authors:
25 *      Fabian 'x3n' Landau
26 *
27 */
28
29/**
30    @file AbstractRadiusHeightCollisionShape.h
31    @brief Definition of the AbstractRadiusHeightCollisionShape class.
32    @ingroup Collisionshapes
33*/
34
35#ifndef _AbstractRadiusHeightCollisionShape_H__
36#define _AbstractRadiusHeightCollisionShape_H__
37
38#include "objects/ObjectsPrereqs.h"
39#include "collisionshapes/CollisionShape.h"
40
41namespace orxonox
42{
43
44    /**
45    @brief
46        Wrapper for the bullet collision shapes with radius and height.
47
48    @ingroup Collisionshapes
49    */
50    class _ObjectsExport AbstractRadiusHeightCollisionShape : public CollisionShape
51    {
52        public:
53            AbstractRadiusHeightCollisionShape(Context* context);
54
55            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
56
57            /**
58            @brief Set the radius of the AbstractRadiusHeightCollisionShape.
59                   If the radius changes, this causes the internal collision shape to be recreated.
60            @param value The radius to be set.
61            @return Returns true if the radius has changed, false if not.
62            */
63            inline bool setRadius(float value)
64                { if(this->radius_ == value) return false; this->radius_ = value; updateShape(); return true; }
65            /**
66            @brief Get the radius of the AbstractRadiusHeightCollisionShape.
67            @return Returns the radius of the AbstractRadiusHeightCollisionShape.
68            */
69            inline float getRadius() const
70                { return radius_; }
71
72            /**
73            @brief Set the height of the AbstractRadiusHeightCollisionShape.
74                   If the height changes, this causes the internal collision shape to be recreated.
75            @param value The height to be set.
76            @return Returns true if the height has changed, false if not.
77            */
78            inline bool setHeight(float value)
79                { if(this->height_ == value) return false; this->height_ = value; updateShape(); return true; }
80            /**
81            @brief Get the height of the AbstractRadiusHeightCollisionShape.
82            @return Returns the height of the AbstractRadiusHeightCollisionShape.
83            */
84            inline float getHeight() const
85                { return this->height_; }
86
87            virtual void changedScale(); // Is called when the scale of the AbstractRadiusHeightCollisionShape has changed.
88
89        private:
90            void registerVariables();
91
92            float radius_; //!< The radius of the AbstractRadiusHeightCollisionShape.
93            float height_; //!< The height of the AbstractRadiusHeightCollisionShape.
94     };
95}
96
97#endif /* _AbstractRadiusHeightCollisionShape_H__ */
Note: See TracBrowser for help on using the repository browser.