Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/objects/collisionshapes/AbstractRadiusHeightCollisionShape.h @ 12302

Last change on this file since 12302 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
RevLine 
[2486]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:
[10189]25 *      Fabian 'x3n' Landau
[2486]26 *
27 */
28
[7601]29/**
[10189]30    @file AbstractRadiusHeightCollisionShape.h
31    @brief Definition of the AbstractRadiusHeightCollisionShape class.
[7601]32    @ingroup Collisionshapes
33*/
34
[10189]35#ifndef _AbstractRadiusHeightCollisionShape_H__
36#define _AbstractRadiusHeightCollisionShape_H__
[2486]37
[5730]38#include "objects/ObjectsPrereqs.h"
[5735]39#include "collisionshapes/CollisionShape.h"
[2486]40
41namespace orxonox
42{
[8706]43
44    /**
45    @brief
[10189]46        Wrapper for the bullet collision shapes with radius and height.
[8706]47
48    @ingroup Collisionshapes
49    */
[10189]50    class _ObjectsExport AbstractRadiusHeightCollisionShape : public CollisionShape
[2486]51    {
52        public:
[10189]53            AbstractRadiusHeightCollisionShape(Context* context);
[2486]54
55            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
56
[8706]57            /**
[10189]58            @brief Set the radius of the AbstractRadiusHeightCollisionShape.
[8706]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            /**
[10189]66            @brief Get the radius of the AbstractRadiusHeightCollisionShape.
67            @return Returns the radius of the AbstractRadiusHeightCollisionShape.
[8706]68            */
[2486]69            inline float getRadius() const
70                { return radius_; }
71
[8706]72            /**
[10189]73            @brief Set the height of the AbstractRadiusHeightCollisionShape.
[8706]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            /**
[10189]81            @brief Get the height of the AbstractRadiusHeightCollisionShape.
82            @return Returns the height of the AbstractRadiusHeightCollisionShape.
[8706]83            */
[2486]84            inline float getHeight() const
85                { return this->height_; }
86
[10189]87            virtual void changedScale(); // Is called when the scale of the AbstractRadiusHeightCollisionShape has changed.
[8706]88
[2514]89        private:
[7163]90            void registerVariables();
91
[10189]92            float radius_; //!< The radius of the AbstractRadiusHeightCollisionShape.
93            float height_; //!< The height of the AbstractRadiusHeightCollisionShape.
[2486]94     };
95}
96
[10189]97#endif /* _AbstractRadiusHeightCollisionShape_H__ */
Note: See TracBrowser for help on using the repository browser.