diff --git a/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/libLibGIMPACT.a.dep b/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/libLibGIMPACT.a.dep index 8d690e35d..d902bbdc2 100644 --- a/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/libLibGIMPACT.a.dep +++ b/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/libLibGIMPACT.a.dep @@ -1,7 +1,7 @@ -00000000002a1016000000000000944b 582e883c151ba574c0f5b6085732499b ffffffffffffffffffffffffffffffff 61676 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_tri_collision.o -0000000044427ffb000000000000cc2e fadb4c71fc3b509301f1b79175fc75b7 ffffffffffffffffffffffffffffffff 6748 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_memory.o -00000000464e4b6e000000000000af12 54d6f4ff7c506f1e8f42a617b21b1f30 ffffffffffffffffffffffffffffffff 48500 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_contact.o -00000000001ce1140000000000005087 8abd5fd65e40fdff4b616094d8f3a471 ffffffffffffffffffffffffffffffff 54688 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_box_set.o -00000000467d375200000000000039ed d7bf46a0db97844dd677c02246b8f3a8 ffffffffffffffffffffffffffffffff 235632 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/btGImpactShape.o -0000000000200129000000000000dc1f 70e1b343c97824104bf5cf6ce036c670 ffffffffffffffffffffffffffffffff 385580 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/btGImpactCollisionAlgorithm.o +00000000002a1016000000000000944b 582e883c151ba574c0f5b6085732499b ffffffffffffffffffffffffffffffff 0 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_tri_collision.o +0000000044427ffb000000000000cc2e fadb4c71fc3b509301f1b79175fc75b7 ffffffffffffffffffffffffffffffff 0 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_memory.o +00000000464e4b6e000000000000af12 54d6f4ff7c506f1e8f42a617b21b1f30 ffffffffffffffffffffffffffffffff 0 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_contact.o +00000000001ce1140000000000005087 8abd5fd65e40fdff4b616094d8f3a471 ffffffffffffffffffffffffffffffff 0 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/gim_box_set.o +00000000467d375200000000000039ed d7bf46a0db97844dd677c02246b8f3a8 ffffffffffffffffffffffffffffffff 0 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/btGImpactShape.o +0000000000200129000000000000dc1f 70e1b343c97824104bf5cf6ce036c670 ffffffffffffffffffffffffffffffff 0 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/BULLET_PHYSICS.build/Debug/libLibGIMPACT.a.build/Objects-normal/i386/btGImpactCollisionAlgorithm.o dbc09a87dbc430ff98a5c854eea8f3d1 32e74142d5c8ece00339d5418a5668e7 ffffffffffffffffffffffffffffffff 834284 /Users/erwincoumans/develop/sf/bullet-2.54/Extras/GIMPACT/Debug/libLibGIMPACT.a diff --git a/VERSION b/VERSION index 5be476cb3..2b86357ec 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ -Bullet Collision Detection and Physics Library version 2.53 +Bullet Collision Detection and Physics Library version 2.54 http://bullet.sourceforge.net diff --git a/configure b/configure index 1f5b7709f..934496fed 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for bullet 2.53. +# Generated by GNU Autoconf 2.59 for bullet 2.54. # # Report bugs to . # @@ -271,8 +271,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='bullet' PACKAGE_TARNAME='bullet' -PACKAGE_VERSION='2.53' -PACKAGE_STRING='bullet 2.53' +PACKAGE_VERSION='2.54' +PACKAGE_STRING='bullet 2.54' PACKAGE_BUGREPORT='bullet@erwincoumans.com' ac_unique_file="mk/jam/build.jam" @@ -790,7 +790,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bullet 2.53 to adapt to many kinds of systems. +\`configure' configures bullet 2.54 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -855,7 +855,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bullet 2.53:";; + short | recursive ) echo "Configuration of bullet 2.54:";; esac cat <<\_ACEOF @@ -980,7 +980,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -bullet configure 2.53 +bullet configure 2.54 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -994,7 +994,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bullet $as_me 2.53, which was +It was created by bullet $as_me 2.54, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -9898,7 +9898,7 @@ cs_jamconfig_text="${cs_jamconfig_text}PACKAGE_NAME ?= \"$PACKAGE_NAME\" ; " cs_jamconfig_text="${cs_jamconfig_text}PACKAGE_COPYRIGHT ?= \"$PACKAGE_COPYRIGHT\" ; " - for cs_veritem in 2 53; do + for cs_veritem in 2 54; do cs_jamconfig_text="${cs_jamconfig_text}PACKAGE_VERSION_LIST += \"$cs_veritem\" ; " done @@ -10275,7 +10275,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by bullet $as_me 2.53, which was +This file was extended by bullet $as_me 2.54, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -10338,7 +10338,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -bullet config.status 2.53 +bullet config.status 2.54 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index b4cf2b672..439f76e3d 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_PREREQ([2.54]) #---------------------------------------------------------------------------- AC_INIT( [bullet], - [2.53], + [2.54], [bullet@erwincoumans.com]) CS_PACKAGEINFO( [Bullet Continuous Collision Detection and Physics Library], diff --git a/src/BulletCollision/CMakeLists.txt b/src/BulletCollision/CMakeLists.txt index e565bf7ed..93a3afc21 100644 --- a/src/BulletCollision/CMakeLists.txt +++ b/src/BulletCollision/CMakeLists.txt @@ -33,6 +33,7 @@ ADD_LIBRARY(LibBulletCollision CollisionShapes/btConvexTriangleMeshShape.cpp CollisionShapes/btCylinderShape.cpp CollisionShapes/btEmptyShape.cpp + CollisionShapes/btHeightfieldTerrainShape.cpp CollisionShapes/btMinkowskiSumShape.cpp CollisionShapes/btMultiSphereShape.cpp CollisionShapes/btOptimizedBvh.cpp diff --git a/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp index 49f35c2cc..b49036a5b 100644 --- a/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp +++ b/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp @@ -17,6 +17,8 @@ subject to the following restrictions: #include "btCollisionDispatcher.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "BulletCollision/CollisionShapes/btCollisionShape.h" +#include "BulletCollision/CollisionShapes/btConvexShape.h" + #include "BulletCollision/CollisionShapes/btSphereShape.h" //for raycasting #include "BulletCollision/CollisionShapes/btTriangleMeshShape.h" //for raycasting #include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h" @@ -179,12 +181,27 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra btCollisionObject* collisionObject, const btCollisionShape* collisionShape, const btTransform& colObjWorldTransform, - RayResultCallback& resultCallback) + RayResultCallback& resultCallback,short int collisionFilterMask) { btSphereShape pointShape(btScalar(0.0)); pointShape.setMargin(0.f); + objectQuerySingle(&pointShape,rayFromTrans,rayToTrans, + collisionObject, + collisionShape, + colObjWorldTransform, + resultCallback,collisionFilterMask); +} + +void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const btTransform& rayFromTrans,const btTransform& rayToTrans, + btCollisionObject* collisionObject, + const btCollisionShape* collisionShape, + const btTransform& colObjWorldTransform, + RayResultCallback& resultCallback,short int collisionFilterMask) +{ + + if (collisionShape->isConvex()) { btConvexCast::CastResult castResult; @@ -192,9 +209,9 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra btConvexShape* convexShape = (btConvexShape*) collisionShape; btVoronoiSimplexSolver simplexSolver; - btSubsimplexConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); - //GjkConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); - //ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0); + btSubsimplexConvexCast convexCaster(castShape,convexShape,&simplexSolver); + //GjkConvexCast convexCaster(castShape,convexShape,&simplexSolver); + //ContinuousConvexCollision convexCaster(castShape,convexShape,&simplexSolver,0); if (convexCaster.calcTimeOfImpact(rayFromTrans,rayToTrans,colObjWorldTransform,colObjWorldTransform,castResult)) { @@ -292,11 +309,11 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra btTransform childTrans = compoundShape->getChildTransform(i); const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i); btTransform childWorldTrans = colObjWorldTransform * childTrans; - rayTestSingle(rayFromTrans,rayToTrans, + objectQuerySingle(castShape, rayFromTrans,rayToTrans, collisionObject, childCollisionShape, childWorldTrans, - resultCallback); + resultCallback, collisionFilterMask); } @@ -306,7 +323,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra } } -void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) +void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback,short int collisionFilterMask) { @@ -323,21 +340,22 @@ void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& r for (i=0;igetBroadphaseHandle()->m_collisionFilterGroup & collisionFilterMask) { + //RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject(); + btVector3 collisionObjectAabbMin,collisionObjectAabbMax; + collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax); - //RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject(); - btVector3 collisionObjectAabbMin,collisionObjectAabbMax; - collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax); - - btScalar hitLambda = btScalar(1.); //could use resultCallback.m_closestHitFraction, but needs testing - btVector3 hitNormal; - if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal)) - { - rayTestSingle(rayFromTrans,rayToTrans, - collisionObject, - collisionObject->getCollisionShape(), - collisionObject->getWorldTransform(), - resultCallback); - + btScalar hitLambda = btScalar(1.); //could use resultCallback.m_closestHitFraction, but needs testing + btVector3 hitNormal; + if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal)) + { + rayTestSingle(rayFromTrans,rayToTrans, + collisionObject, + collisionObject->getCollisionShape(), + collisionObject->getWorldTransform(), + resultCallback); + } } } diff --git a/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/src/BulletCollision/CollisionDispatch/btCollisionWorld.h index 0b0286c50..b6d80233a 100644 --- a/src/BulletCollision/CollisionDispatch/btCollisionWorld.h +++ b/src/BulletCollision/CollisionDispatch/btCollisionWorld.h @@ -53,9 +53,9 @@ subject to the following restrictions: * Bullet has been designed in a modular way keeping dependencies to a minimum. The ConvexHullDistance demo demonstrates direct use of btGjkPairDetector. * * @section copyright Copyright - * Copyright (C) 2005-2006 Erwin Coumans, some contributions Copyright Gino van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter(res), Stephane Redon + * Copyright (C) 2005-2007 Erwin Coumans, some contributions Copyright Gino van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter(res), Stephane Redon * Special thanks to all visitors of the Bullet Physics forum, and in particular above contributors, Dave Eberle, Dirk Gregorius, Erin Catto, Dave Eberle, Adam Moravanszky, - * Pierre Terdiman, Kenny Erleben, Russell Smith, Oliver Strunk, Jan Paul van Waveren. + * Pierre Terdiman, Kenny Erleben, Russell Smith, Oliver Strunk, Jan Paul van Waveren, Marten Svanfeldt. * */ @@ -66,6 +66,7 @@ subject to the following restrictions: class btStackAlloc; class btCollisionShape; +class btConvexShape; class btBroadphaseInterface; #include "../../LinearMath/btVector3.h" #include "../../LinearMath/btTransform.h" @@ -208,7 +209,7 @@ public: /// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback /// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback. - void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback); + void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback, short int collisionFilterMask=-1); /// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest. /// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape. @@ -217,7 +218,14 @@ public: btCollisionObject* collisionObject, const btCollisionShape* collisionShape, const btTransform& colObjWorldTransform, - RayResultCallback& resultCallback); + RayResultCallback& resultCallback, short int collisionFilterMask=-1); + + /// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest. + static void objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans,const btTransform& rayToTrans, + btCollisionObject* collisionObject, + const btCollisionShape* collisionShape, + const btTransform& colObjWorldTransform, + RayResultCallback& resultCallback, short int collisionFilterMask=-1); void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1); diff --git a/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp b/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp index b213f3819..015314bc0 100644 --- a/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp +++ b/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp @@ -16,7 +16,7 @@ subject to the following restrictions: #include "btMinkowskiSumShape.h" -btMinkowskiSumShape::btMinkowskiSumShape(btConvexShape* shapeA,btConvexShape* shapeB) +btMinkowskiSumShape::btMinkowskiSumShape(const btConvexShape* shapeA,const btConvexShape* shapeB) :m_shapeA(shapeA), m_shapeB(shapeB) { diff --git a/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.h b/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.h index 489b7ddde..198faaff9 100644 --- a/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.h +++ b/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.h @@ -25,12 +25,12 @@ class btMinkowskiSumShape : public btConvexShape btTransform m_transA; btTransform m_transB; - btConvexShape* m_shapeA; - btConvexShape* m_shapeB; + const btConvexShape* m_shapeA; + const btConvexShape* m_shapeB; public: - btMinkowskiSumShape(btConvexShape* shapeA,btConvexShape* shapeB); + btMinkowskiSumShape(const btConvexShape* shapeA,const btConvexShape* shapeB); virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; diff --git a/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp b/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp index 1ab336b4d..687738b7f 100644 --- a/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp +++ b/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp @@ -20,7 +20,7 @@ subject to the following restrictions: #include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h" -btSubsimplexConvexCast::btSubsimplexConvexCast (btConvexShape* convexA,btConvexShape* convexB,btSimplexSolverInterface* simplexSolver) +btSubsimplexConvexCast::btSubsimplexConvexCast (const btConvexShape* convexA,const btConvexShape* convexB,btSimplexSolverInterface* simplexSolver) :m_simplexSolver(simplexSolver), m_convexA(convexA),m_convexB(convexB) { diff --git a/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h b/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h index a2a3193b0..05662db5d 100644 --- a/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h +++ b/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h @@ -28,12 +28,12 @@ class btConvexShape; class btSubsimplexConvexCast : public btConvexCast { btSimplexSolverInterface* m_simplexSolver; - btConvexShape* m_convexA; - btConvexShape* m_convexB; + const btConvexShape* m_convexA; + const btConvexShape* m_convexB; public: - btSubsimplexConvexCast (btConvexShape* shapeA,btConvexShape* shapeB,btSimplexSolverInterface* simplexSolver); + btSubsimplexConvexCast (const btConvexShape* shapeA,const btConvexShape* shapeB,btSimplexSolverInterface* simplexSolver); //virtual ~btSubsimplexConvexCast(); ///SimsimplexConvexCast calculateTimeOfImpact calculates the time of impact+normal for the linear cast (sweep) between two moving objects.