diff --git a/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.cpp b/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.cpp index 00b9e2e1a..ec2eda257 100644 --- a/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.cpp +++ b/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.cpp @@ -181,7 +181,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration } */ - //OverlappingPairCache* scene = getCollisionWorld()->getPairCache(); + //btOverlappingPairCache* scene = getCollisionWorld()->getPairCache(); btContactSolverInfo solverInfo; @@ -449,10 +449,13 @@ void SimulationIsland::UpdateAabbs(btIDebugDraw* debugDrawer,btBroadphaseInterfa if (reportMe) { reportMe = false; + assert(0); + /* printf("Overflow in AABB, object removed from simulation \n"); printf("If you can reproduce this, please email bugs@continuousphysics.com\n"); printf("Please include above information, your Platform, version of OS.\n"); printf("Thanks.\n"); + */ } } diff --git a/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h b/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h index 069de5c76..92aa18ee5 100644 --- a/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h +++ b/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h @@ -55,7 +55,7 @@ CONCAVE_SHAPES_END_HERE, }; -///BroadphaseProxy +///btBroadphaseProxy struct btBroadphaseProxy { diff --git a/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h b/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h index 3f32cf460..70fa11b2c 100644 --- a/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h +++ b/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h @@ -37,7 +37,7 @@ struct btCollisionAlgorithmConstructionInfo }; -///CollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatcher. +///btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatcher. ///It is persistent over frames class btCollisionAlgorithm { diff --git a/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h b/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h index 3ce1ac4fe..008349030 100644 --- a/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h +++ b/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h @@ -33,7 +33,7 @@ virtual ~btOverlapCallback() virtual bool processOverlap(btBroadphasePair& pair) = 0; }; -///OverlappingPairCache maintains the objects with overlapping AABB +///btOverlappingPairCache maintains the objects with overlapping AABB ///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase class btOverlappingPairCache : public btBroadphaseInterface { diff --git a/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h b/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h index dfe1b5eed..aede551ac 100644 --- a/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h +++ b/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h @@ -33,7 +33,7 @@ class btOverlappingPairCache; -///CollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs. +///btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs. ///Time of Impact, Closest Points and Penetration Depth. class btCollisionDispatcher : public btDispatcher { diff --git a/src/BulletCollision/CollisionDispatch/btManifoldResult.h b/src/BulletCollision/CollisionDispatch/btManifoldResult.h index bf6e54535..6b4b3f1e6 100644 --- a/src/BulletCollision/CollisionDispatch/btManifoldResult.h +++ b/src/BulletCollision/CollisionDispatch/btManifoldResult.h @@ -27,7 +27,7 @@ extern ContactAddedCallback gContactAddedCallback; -///ManifoldResult is a helper class to manage contact results. +///btManifoldResult is a helper class to manage contact results. class btManifoldResult : public btDiscreteCollisionDetectorInterface::Result { btPersistentManifold* m_manifoldPtr; diff --git a/src/BulletCollision/CollisionShapes/btBoxShape.cpp b/src/BulletCollision/CollisionShapes/btBoxShape.cpp index cb14caa64..b5f80de45 100644 --- a/src/BulletCollision/CollisionShapes/btBoxShape.cpp +++ b/src/BulletCollision/CollisionShapes/btBoxShape.cpp @@ -17,7 +17,7 @@ subject to the following restrictions: btVector3 btBoxShape::getHalfExtents() const { - return m_boxHalfExtents1 * m_localScaling; + return m_implicitShapeDimensions * m_localScaling; } //{ diff --git a/src/BulletCollision/CollisionShapes/btBoxShape.h b/src/BulletCollision/CollisionShapes/btBoxShape.h index 76aa9224f..b137eb115 100644 --- a/src/BulletCollision/CollisionShapes/btBoxShape.h +++ b/src/BulletCollision/CollisionShapes/btBoxShape.h @@ -22,21 +22,17 @@ subject to the following restrictions: #include "LinearMath/btPoint3.h" #include "LinearMath/btSimdMinMax.h" -///BoxShape implements both a feature based (vertex/edge/plane) and implicit (getSupportingVertex) Box +///btBoxShape implements both a feature based (vertex/edge/plane) and implicit (getSupportingVertex) Box class btBoxShape: public btPolyhedralConvexShape { - btVector3 m_boxHalfExtents1; + //btVector3 m_boxHalfExtents1; //use m_implicitShapeDimensions instead public: btVector3 getHalfExtents() const; - //{ return m_boxHalfExtents1 * m_localScaling;} - //const btVector3& getHalfExtents() const{ return m_boxHalfExtents1;} - - - + virtual int getShapeType() const { return BOX_SHAPE_PROXYTYPE;} virtual btVector3 localGetSupportingVertex(const btVector3& vec) const @@ -81,7 +77,10 @@ public: } - btBoxShape( const btVector3& boxHalfExtents) : m_boxHalfExtents1(boxHalfExtents){}; + btBoxShape( const btVector3& boxHalfExtents) + { + m_implicitShapeDimensions = boxHalfExtents; + }; virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const; diff --git a/src/BulletCollision/CollisionShapes/btConvexShape.h b/src/BulletCollision/CollisionShapes/btConvexShape.h index acc14c8ff..3ffde1ba5 100644 --- a/src/BulletCollision/CollisionShapes/btConvexShape.h +++ b/src/BulletCollision/CollisionShapes/btConvexShape.h @@ -33,6 +33,16 @@ struct btConvexCastResult; /// used in combination with GJK or btConvexCast class btConvexShape : public btCollisionShape { + +protected: + + //local scaling. collisionMargin is not scaled ! + btVector3 m_localScaling; + + btVector3 m_implicitShapeDimensions; + + btScalar m_collisionMargin; + public: btConvexShape(); @@ -42,7 +52,10 @@ public: //notice that the vectors should be unit length virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0; - // testing for hullnode code + const btVector3& getImplicitShapeDimensions() const + { + return m_implicitShapeDimensions; + } ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const @@ -70,11 +83,7 @@ public: { return m_collisionMargin; } -private: - btScalar m_collisionMargin; - //local scaling. collisionMargin is not scaled ! -protected: - btVector3 m_localScaling; + }; diff --git a/src/BulletCollision/CollisionShapes/btMultiSphereShape.h b/src/BulletCollision/CollisionShapes/btMultiSphereShape.h index 2025e9c15..6a9151df2 100644 --- a/src/BulletCollision/CollisionShapes/btMultiSphereShape.h +++ b/src/BulletCollision/CollisionShapes/btMultiSphereShape.h @@ -21,7 +21,7 @@ subject to the following restrictions: #define MAX_NUM_SPHERES 5 -///MultiSphereShape represents implicit convex hull of a collection of spheres (using getSupportingVertex) +///btMultiSphereShape represents implicit convex hull of a collection of spheres (using getSupportingVertex) class btMultiSphereShape : public btConvexShape { diff --git a/src/BulletCollision/CollisionShapes/btSphereShape.cpp b/src/BulletCollision/CollisionShapes/btSphereShape.cpp index add22888b..39e458c0f 100644 --- a/src/BulletCollision/CollisionShapes/btSphereShape.cpp +++ b/src/BulletCollision/CollisionShapes/btSphereShape.cpp @@ -20,8 +20,8 @@ subject to the following restrictions: btSphereShape ::btSphereShape (btScalar radius) -: m_radius(radius) -{ +{ + m_implicitShapeDimensions.setX(radius); } btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const diff --git a/src/BulletCollision/CollisionShapes/btSphereShape.h b/src/BulletCollision/CollisionShapes/btSphereShape.h index 231c97c00..2db6a872b 100644 --- a/src/BulletCollision/CollisionShapes/btSphereShape.h +++ b/src/BulletCollision/CollisionShapes/btSphereShape.h @@ -19,11 +19,10 @@ subject to the following restrictions: #include "btConvexShape.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types -///SphereShape implements an implicit (getSupportingVertex) Sphere +///btSphereShape implements an implicit (getSupportingVertex) Sphere class btSphereShape : public btConvexShape { - btScalar m_radius; public: btSphereShape (btScalar radius); @@ -41,7 +40,7 @@ public: virtual int getShapeType() const { return SPHERE_SHAPE_PROXYTYPE; } - btScalar getRadius() const { return m_radius;} + btScalar getRadius() const { return m_implicitShapeDimensions.getX();} //debugging virtual char* getName()const {return "SPHERE";} @@ -54,7 +53,7 @@ public: { //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[0] * m_radius + btConvexShape::getMargin(); + return m_localScaling.getX() * getRadius() + btConvexShape::getMargin(); } diff --git a/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h b/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h index cbe4cca92..d0cc2577f 100644 --- a/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h +++ b/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h @@ -34,7 +34,7 @@ extern ContactDestroyedCallback gContactDestroyedCallback; #define MANIFOLD_CACHE_SIZE 4 -///PersistentManifold maintains contact points, and reduces them to 4. +///btPersistentManifold maintains contact points, and reduces them to 4. ///It does contact filtering/contact reduction. class btPersistentManifold {