diff options
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.h')
-rw-r--r-- | extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.h index 66521664087..a6d01cdca9d 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.h +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.h @@ -16,15 +16,17 @@ subject to the following restrictions: #ifndef SPHERE_MINKOWSKI_H #define SPHERE_MINKOWSKI_H -#include "btConvexShape.h" -#include "../BroadphaseCollision/btBroadphaseProxy.h" // for the types +#include "btConvexInternalShape.h" +#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types -///btSphereShape implements an implicit (getSupportingVertex) Sphere -ATTRIBUTE_ALIGNED16(class) btSphereShape : public btConvexShape +///The btSphereShape implements an implicit sphere, centered around a local origin with radius. +ATTRIBUTE_ALIGNED16(class) btSphereShape : public btConvexInternalShape { public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + btSphereShape (btScalar radius); @@ -34,26 +36,32 @@ public: virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; - virtual void calculateLocalInertia(btScalar mass,btVector3& inertia); + virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const; virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const; virtual int getShapeType() const { return SPHERE_SHAPE_PROXYTYPE; } - btScalar getRadius() const { return m_implicitShapeDimensions.getX();} + btScalar getRadius() const { return m_implicitShapeDimensions.getX() * m_localScaling.getX();} + + void setUnscaledRadius(btScalar radius) + { + m_implicitShapeDimensions.setX(radius); + btConvexInternalShape::setMargin(radius); + } //debugging - virtual char* getName()const {return "SPHERE";} + virtual const char* getName()const {return "SPHERE";} virtual void setMargin(btScalar margin) { - btConvexShape::setMargin(margin); + btConvexInternalShape::setMargin(margin); } virtual btScalar getMargin() const { //to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case //this means, non-uniform scaling is not supported anymore - return m_localScaling.getX() * getRadius() + btConvexShape::getMargin(); + return getRadius(); } |