Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.cc @ 2306

Last change on this file since 2306 was 2306, checked in by rgrieder, 15 years ago
  • More dealings with not yet implemented scaling of physical objects.
  • Clearer handling of masses specified by setMass() (also taking into account mass of child WE)
  • Now calculating the inertia tensor as well according to mass and collisionShape
  • Bugfix when calling Bullet solver
  • Property svn:eol-style set to native
File size: 2.6 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 "CollisionShape.h"
31
32#include "BulletCollision/CollisionShapes/btCollisionShape.h"
33
34#include "util/Exception.h"
35#include "core/CoreIncludes.h"
36#include "core/XMLPort.h"
37#include "tools/BulletConversions.h"
38
39namespace orxonox
40{
41    CreateFactory(CollisionShape);
42
43    CollisionShape::CollisionShape(BaseObject* creator) : StaticEntity(creator)
44    {
45        RegisterObject(CollisionShape);
46
47        this->bIsCompound_ = false;
48    }
49
50    CollisionShape::~CollisionShape()
51    {
52    }
53
54    void CollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
55    {
56        SUPER(CollisionShape, XMLPort, xmlelement, mode);
57    }
58
59    bool CollisionShape::isCollisionTypeLegal(WorldEntity::CollisionType type) const
60    {
61        if (type != WorldEntity::None)
62        {
63            ThrowException(PhysicsViolation, "A CollisionShape can only have CollisionType 'None'.");
64            return false;
65        }
66        else
67            return true;
68    }
69
70    bool CollisionShape::hasNoTransform() const
71    {
72        return (this->getPosition().positionEquals(Vector3(0, 0, 0), 0.001) &&
73                this->getOrientation().equals(Quaternion(1,0,0,0), Degree(0.1)));
74    }
75
76    btVector3 CollisionShape::getTotalScaling()
77    {
78        return omni_cast<btVector3>(this->node_->getScale());
79    }
80
81    void CollisionShape::setScale3D(const Vector3& scale)
82    {
83        ThrowException(NotImplemented, "Cannot set the scale of a collision shape: Not yet implemented.");
84    }
85
86    void CollisionShape::scale3D(const Vector3& scale)
87    {
88        ThrowException(NotImplemented, "Cannot set the scale of a collision shape: Not yet implemented.");
89    }
90}
Note: See TracBrowser for help on using the repository browser.