Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ggz/src/orxonox/objects/worldentities/MovableEntity.h @ 3050

Last change on this file since 3050 was 2662, checked in by rgrieder, 16 years ago

Merged presentation branch back to trunk.

  • Property svn:eol-style set to native
File size: 2.8 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 *      Fabian 'x3n' Landau
24 *      Reto Grieder
25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#ifndef _MovableEntity_H__
31#define _MovableEntity_H__
32
33#include "OrxonoxPrereqs.h"
34
35#include "MobileEntity.h"
36#include "network/ClientConnectionListener.h"
37#include "tools/Timer.h"
38
39namespace orxonox
40{
41    class _OrxonoxExport MovableEntity : public MobileEntity, public ClientConnectionListener
42    {
43        public:
44            MovableEntity(BaseObject* creator);
45            virtual ~MovableEntity();
46
47            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
48            void registerVariables();
49
50            using WorldEntity::setPosition;
51            using WorldEntity::setOrientation;
52
53            inline void setPosition(const Vector3& position)
54                { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); }
55            inline void setOrientation(const Quaternion& orientation)
56                { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); }
57
58        private:
59            void clientConnected(unsigned int clientID);
60            void clientDisconnected(unsigned int clientID);
61            void resynchronize();
62
63            inline void processLinearVelocity()
64                { this->setVelocity(this->linearVelocity_); }
65            inline void processAngularVelocity()
66                { this->setAngularVelocity(this->angularVelocity_); }
67
68            inline void overwritePosition()
69                { this->setPosition(this->overwrite_position_); }
70            inline void overwriteOrientation()
71                { this->setOrientation(this->overwrite_orientation_); }
72
73            Vector3    overwrite_position_;
74            Quaternion overwrite_orientation_;
75
76            Timer<MovableEntity> resynchronizeTimer_;
77            Timer<MovableEntity>* continuousResynchroTimer_;
78    };
79}
80
81#endif /* _MovableEntity_H__ */
Note: See TracBrowser for help on using the repository browser.