Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/orxonox/objects/collisionshapes/WorldEntityCollisionShape.cc @ 2562

Last change on this file since 2562 was 2562, checked in by rgrieder, 15 years ago
  • Added WorldEntityCollisionShape to clarify when a CompoundCollisionShape belongs to a WE.
  • Also fixed problems with the synchronisation of the CollisionShape hierarchy.
  • Property svn:eol-style set to native
File size: 2.2 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 *      ...
26 *
27 */
28
29#include "OrxonoxStableHeaders.h"
30#include "WorldEntityCollisionShape.h"
31
32#include "BulletCollision/CollisionShapes/btCompoundShape.h"
33
34#include "util/Exception.h"
35#include "core/CoreIncludes.h"
36#include "objects/worldentities/WorldEntity.h"
37
38namespace orxonox
39{
40    WorldEntityCollisionShape::WorldEntityCollisionShape(WorldEntity* creator) : CompoundCollisionShape(creator)
41    {
42        RegisterObject(WorldEntityCollisionShape);
43
44        this->worldEntityOwner_ = creator;
45        // suppress synchronisation
46        this->setObjectMode(0x0);
47    }
48
49    WorldEntityCollisionShape::~WorldEntityCollisionShape()
50    {
51        // Called always by WE destructor
52    }
53
54    void WorldEntityCollisionShape::updateParent()
55    {
56        // Note: This shape may also be attached to a CompoundCollisionShape because it's hosting
57        // WorldEntity has been attached to another one.
58        CollisionShape::updateParent();
59
60        assert(this->worldEntityOwner_ != 0);
61        this->worldEntityOwner_->notifyCollisionShapeChanged();
62    }
63
64    void WorldEntityCollisionShape::parentChanged()
65    {
66        // This object does not get synchronised. This method should never be called then!
67        OrxAssert(false, "parentChanged has been called on a non synchronised WorldEntityCollisionShape!");
68    }
69}
Note: See TracBrowser for help on using the repository browser.