diff --git a/Demos/BasicDemo/BasicDemo.cpp b/Demos/BasicDemo/BasicDemo.cpp index f6ba2d416..1679c67de 100644 --- a/Demos/BasicDemo/BasicDemo.cpp +++ b/Demos/BasicDemo/BasicDemo.cpp @@ -87,6 +87,7 @@ void BasicDemo::initPhysics() ///collision configuration contains default setup for memory, collision setup m_collisionConfiguration = new btDefaultCollisionConfiguration(); + //m_collisionConfiguration->setConvexConvexMultipointIterations(); ///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded) m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration); @@ -173,6 +174,7 @@ void BasicDemo::initPhysics() btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform); btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colShape,localInertia); btRigidBody* body = new btRigidBody(rbInfo); + //body->setContactProcessingThreshold(colShape->getContactBreakingThreshold()); body->setActivationState(ISLAND_SLEEPING); m_dynamicsWorld->addRigidBody(body); diff --git a/Demos/BasicDemo/main.cpp b/Demos/BasicDemo/main.cpp index 21b9496e4..2773a6553 100644 --- a/Demos/BasicDemo/main.cpp +++ b/Demos/BasicDemo/main.cpp @@ -81,7 +81,7 @@ int main(int argc,char** argv) #ifdef CHECK_MEMORY_LEAKS ccdDemo.exitPhysics(); #else - return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&ccdDemo); + return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&ccdDemo); #endif //default glut doesn't return from mainloop diff --git a/Demos/CcdPhysicsDemo/main.cpp b/Demos/CcdPhysicsDemo/main.cpp index 9f9fe2dca..3d0955a7d 100644 --- a/Demos/CcdPhysicsDemo/main.cpp +++ b/Demos/CcdPhysicsDemo/main.cpp @@ -41,7 +41,7 @@ int main(int argc,char** argv) ccdDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); - glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",ccdDemo); + glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",ccdDemo); delete ccdDemo; return 0; diff --git a/Demos/GenericJointDemo/GenericJointDemo.h b/Demos/GenericJointDemo/GenericJointDemo.h index 7d224b11e..c6d8ed91b 100644 --- a/Demos/GenericJointDemo/GenericJointDemo.h +++ b/Demos/GenericJointDemo/GenericJointDemo.h @@ -1,44 +1,44 @@ -/* -Bullet Continuous Collision Detection and Physics Library -GenericJointDemo -Copyright (c) 2007 Starbreeze Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Marten Svanfeldt -*/ - -#ifndef GENERIGJOINTDEMO_H -#define GENERIGJOINTDEMO_H - -#include "DemoApplication.h" +/* +Bullet Continuous Collision Detection and Physics Library +GenericJointDemo +Copyright (c) 2007 Starbreeze Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Marten Svanfeldt +*/ + +#ifndef GENERIGJOINTDEMO_H +#define GENERIGJOINTDEMO_H + +#include "DemoApplication.h" #include "LinearMath/btAlignedObjectArray.h" -#include "Ragdoll.h" - -class GenericJointDemo : public DemoApplication -{ - - btAlignedObjectArray m_ragdolls; - -public: - void initPhysics(); - - void spawnRagdoll(bool random = false); - - virtual void clientMoveAndDisplay(); - - virtual void displayCallback(); - - virtual void keyboardCallback(unsigned char key, int x, int y); -}; - - -#endif +#include "Ragdoll.h" + +class GenericJointDemo : public DemoApplication +{ + + btAlignedObjectArray m_ragdolls; + +public: + void initPhysics(); + + void spawnRagdoll(bool random = false); + + virtual void clientMoveAndDisplay(); + + virtual void displayCallback(); + + virtual void keyboardCallback(unsigned char key, int x, int y); +}; + + +#endif diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.cpp b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.cpp index ec1ac14c0..cf5c58ebe 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.cpp +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.cpp @@ -1,3 +1,20 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ + #include #include "btHfFluid.h" #include "btHfFluidCollisionShape.h" diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.h b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.h index 5f79a8866..551c253cc 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.h +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluid.h @@ -1,3 +1,20 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ + #ifndef __HFFLUID_H #define __HFFLUID_H @@ -14,6 +31,7 @@ class btManifoldResult; // add buoyant convex vs. convex / concave // add buoyant concave support (try bunny model) +///experimental buyancy fluid demo class btHfFluid : public btCollisionObject { public: diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.cpp b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.cpp index c2d4bb5bd..28c131e6f 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.cpp +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.cpp @@ -1,3 +1,19 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ #include #include "LinearMath/btAabbUtil2.h" diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.h b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.h index 5590d6343..72266625b 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.h +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantConvexShape.h @@ -1,3 +1,19 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ #ifndef __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H #define __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H @@ -7,7 +23,7 @@ #define MAX_VOXEL_DIMENSION 32 class btConvexShape; - +///experimental buyancy fluid demo class btHfFluidBuoyantConvexShape : public btCollisionShape { public: diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.cpp b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.cpp index 660861091..91e4d4c97 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.cpp +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.cpp @@ -1,3 +1,19 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ #include #include "btHfFluidBuoyantShapeCollisionAlgorithm.h" diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.h b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.h index 580ced3b2..cb7924494 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.h +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidBuoyantShapeCollisionAlgorithm.h @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #ifndef HF_FLUID_BUOYANT_SHAPE_COLLISION_ALGORITHM_H @@ -31,6 +33,8 @@ class btHfFluid; class btConvexConvexAlgorithm; class btConvexPenetrationDepthSolver; class btSimplexSolverInterface; + +///experimental buyancy fluid demo /// btHfFluidBuoyantShapeCollisionAlgorithm provides collision detection between btHfFluidBuoyantConvexShape and btHfFluidBuoyantConvexShape class btHfFluidBuoyantShapeCollisionAlgorithm : public btCollisionAlgorithm { diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.cpp b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.cpp index 0ac51da06..1d78a1489 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.cpp +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.cpp @@ -1,2 +1,18 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ #include "btHfFluidCollisionShape.h" diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.h b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.h index 3d2182eff..56f01e4cd 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.h +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidCollisionShape.h @@ -1,3 +1,19 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ #ifndef BT_HF_FLUID_COLLISION_SHAPE_H #define BT_HF_FLUID_COLLISION_SHAPE_H diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.cpp b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.cpp index e361589db..e89f54862 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.cpp +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.cpp @@ -1,3 +1,20 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan +*/ + #include #include "btHfFluidRigidCollisionAlgorithm.h" diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.h b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.h index e7223ace8..0b69a63bf 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.h +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionAlgorithm.h @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #ifndef HF_FLUID_RIGID_COLLISION_ALGORITHM_H @@ -27,6 +29,7 @@ subject to the following restrictions: #include "LinearMath/btVector3.h" class btHfFluid; +///experimental buyancy fluid demo /// btHfFluidRigidCollisionAlgorithm provides collision detection between btHfFluid and btRigidBody class btHfFluidRigidCollisionAlgorithm : public btCollisionAlgorithm { diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.cpp b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.cpp index bf253e811..374ff0d9d 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.cpp +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.cpp @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #include "btHfFluidRigidCollisionConfiguration.h" diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.h b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.h index 78389cee7..e762ee880 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.h +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidCollisionConfiguration.h @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #ifndef BT_HFFLUID_RIGID_COLLISION_CONFIGURATION @@ -21,7 +23,7 @@ subject to the following restrictions: class btVoronoiSimplexSolver; class btGjkEpaPenetrationDepthSolver; - +///experimental buyancy fluid demo ///btSoftBodyRigidBodyCollisionConfiguration add softbody interaction on top of btDefaultCollisionConfiguration class btHfFluidRigidCollisionConfiguration : public btDefaultCollisionConfiguration { diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.cpp b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.cpp index c8f25490d..165de07ba 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.cpp +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.cpp @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #include diff --git a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.h b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.h index 08ed8c90f..6dfa487c0 100644 --- a/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.h +++ b/Demos/HeightFieldFluidDemo/BulletHfFluid/btHfFluidRigidDynamicsWorld.h @@ -1,16 +1,18 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. +Experimental Buoyancy fluid demo written by John McCutchan */ #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" @@ -31,6 +33,7 @@ typedef btAlignedObjectArray btHfFluidArray; class btHfFluidBuoyantConvexShape; +///experimental buyancy fluid demo class btHfFluidRigidDynamicsWorld : public btDiscreteDynamicsWorld { diff --git a/Demos/HeightFieldFluidDemo/HfFluidDemo.cpp b/Demos/HeightFieldFluidDemo/HfFluidDemo.cpp index 78c198606..1da02925d 100644 --- a/Demos/HeightFieldFluidDemo/HfFluidDemo.cpp +++ b/Demos/HeightFieldFluidDemo/HfFluidDemo.cpp @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #include "btBulletDynamicsCommon.h" diff --git a/Demos/HeightFieldFluidDemo/HfFluidDemo.h b/Demos/HeightFieldFluidDemo/HfFluidDemo.h index e5c0ce855..ef8a7b18a 100644 --- a/Demos/HeightFieldFluidDemo/HfFluidDemo.h +++ b/Demos/HeightFieldFluidDemo/HfFluidDemo.h @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #ifndef HFFLUID_DEMO_H @@ -32,7 +34,7 @@ class btHfFluidRigidDynamicsWorld; ///collisions between a btSoftBody and a btRigidBody class btFluidRididCollisionAlgorithm; - +///experimental buyancy fluid demo ///CcdPhysicsDemo shows basic stacking using Bullet physics, and allows toggle of Ccd (using key '1') class HfFluidDemo : public DemoApplication { diff --git a/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.cpp b/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.cpp index 737ee7de9..a0aee6330 100644 --- a/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.cpp +++ b/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.cpp @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #ifdef WIN32 //needed for glut.h diff --git a/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.h b/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.h index a65e8f226..b9808adf2 100644 --- a/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.h +++ b/Demos/HeightFieldFluidDemo/HfFluidDemo_GL_ShapeDrawer.h @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,12 +11,16 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ + #ifndef HFFLUID_GL_SHAPE_DRAWER_H #define HFFLUID_GL_SHAPE_DRAWER_H #include "GL_ShapeDrawer.h" +///experimental buyancy fluid demo /// OpenGL shape drawing class HfFluidDemo_GL_ShapeDrawer : public GL_ShapeDrawer { diff --git a/Demos/HeightFieldFluidDemo/main.cpp b/Demos/HeightFieldFluidDemo/main.cpp index 6bb566fb1..eb72aad9d 100644 --- a/Demos/HeightFieldFluidDemo/main.cpp +++ b/Demos/HeightFieldFluidDemo/main.cpp @@ -1,6 +1,6 @@ /* Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ +Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -11,6 +11,8 @@ subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. + +Experimental Buoyancy fluid demo written by John McCutchan */ #include "HfFluidDemo.h" @@ -29,7 +31,7 @@ int main(int argc,char** argv) fluidDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); - glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",fluidDemo); + glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",fluidDemo); delete fluidDemo; return 0; diff --git a/Demos/MultiThreadedDemo/main.cpp b/Demos/MultiThreadedDemo/main.cpp index 55c2a1bca..36b56deae 100644 --- a/Demos/MultiThreadedDemo/main.cpp +++ b/Demos/MultiThreadedDemo/main.cpp @@ -28,7 +28,7 @@ int main(int argc,char** argv) demo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); - glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",demo); + glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",demo); delete demo; diff --git a/Demos/RagdollDemo/main.cpp b/Demos/RagdollDemo/main.cpp index e2cf99ebb..87fdf1cec 100644 --- a/Demos/RagdollDemo/main.cpp +++ b/Demos/RagdollDemo/main.cpp @@ -27,5 +27,5 @@ int main(int argc,char* argv[]) demoApp.initPhysics(); demoApp.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); - return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&demoApp); + return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&demoApp); } diff --git a/Demos/SoftDemo/main.cpp b/Demos/SoftDemo/main.cpp index 0ee80ab5b..ec5e70a81 100644 --- a/Demos/SoftDemo/main.cpp +++ b/Demos/SoftDemo/main.cpp @@ -29,7 +29,7 @@ int main(int argc,char** argv) softDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); - glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",softDemo); + glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",softDemo); delete softDemo; return 0; diff --git a/Extras/BulletColladaConverter/ColladaConverter.cpp b/Extras/BulletColladaConverter/ColladaConverter.cpp index f3659fee1..17c2cd2f5 100644 --- a/Extras/BulletColladaConverter/ColladaConverter.cpp +++ b/Extras/BulletColladaConverter/ColladaConverter.cpp @@ -2761,7 +2761,7 @@ bool ColladaConverter::save(const char* filename) } m_dom->getAsset()->getContributor_array().get(0)->getAuthor()->setValue - ("http://bullet.sf.net Erwin Coumans"); + ("http://bulletphysics.com Erwin Coumans"); if (!m_dom->getAsset()->getContributor_array().get(0)->getAuthoring_tool()) { diff --git a/src/BulletDynamics/Character/btCharacterControllerInterface.h b/src/BulletDynamics/Character/btCharacterControllerInterface.h index a5d5cc069..1c045338a 100644 --- a/src/BulletDynamics/Character/btCharacterControllerInterface.h +++ b/src/BulletDynamics/Character/btCharacterControllerInterface.h @@ -17,12 +17,13 @@ subject to the following restrictions: #define CHARACTER_CONTROLLER_INTERFACE_H #include "LinearMath/btVector3.h" +#include "BulletDynamics/Dynamics/btActionInterface.h" class btCollisionShape; class btRigidBody; class btCollisionWorld; -class btCharacterControllerInterface +class btCharacterControllerInterface : public btActionInterface { public: btCharacterControllerInterface () {}; diff --git a/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/src/BulletDynamics/Character/btKinematicCharacterController.cpp index 18164303d..f3ecc2ac1 100644 --- a/src/BulletDynamics/Character/btKinematicCharacterController.cpp +++ b/src/BulletDynamics/Character/btKinematicCharacterController.cpp @@ -116,7 +116,7 @@ btPairCachingGhostObject* btKinematicCharacterController::getGhostObject() return m_ghostObject; } -bool btKinematicCharacterController::recoverFromPenetration (btCollisionWorld* collisionWorld) +bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld* collisionWorld) { bool penetration = false; @@ -390,7 +390,7 @@ void btKinematicCharacterController::warp (const btVector3& origin) } -void btKinematicCharacterController::preStep ( btCollisionWorld* collisionWorld) +void btKinematicCharacterController::preStep ( btCollisionWorld* collisionWorld) { int numPenetrationLoops = 0; @@ -413,7 +413,7 @@ void btKinematicCharacterController::preStep ( btCollisionWorld* collisionWorld) } -void btKinematicCharacterController::playerStep ( btCollisionWorld* collisionWorld, btScalar dt) +void btKinematicCharacterController::playerStep ( btCollisionWorld* collisionWorld, btScalar dt) { btTransform xform; xform = m_ghostObject->getWorldTransform (); @@ -469,3 +469,8 @@ bool btKinematicCharacterController::onGround () const { return true; } + + +void btKinematicCharacterController::debugDraw(btIDebugDraw* debugDrawer) +{ +} \ No newline at end of file diff --git a/src/BulletDynamics/Character/btKinematicCharacterController.h b/src/BulletDynamics/Character/btKinematicCharacterController.h index 932e428f5..5b96863a7 100644 --- a/src/BulletDynamics/Character/btKinematicCharacterController.h +++ b/src/BulletDynamics/Character/btKinematicCharacterController.h @@ -69,7 +69,7 @@ protected: btVector3 parallelComponent (const btVector3& direction, const btVector3& normal); btVector3 perpindicularComponent (const btVector3& direction, const btVector3& normal); - bool recoverFromPenetration (btCollisionWorld* collisionWorld); + bool recoverFromPenetration ( btCollisionWorld* collisionWorld); void stepUp (btCollisionWorld* collisionWorld); void updateTargetPositionBasedOnCollision (const btVector3& hit_normal, btScalar tangentMag = btScalar(0.0), btScalar normalMag = btScalar(1.0)); void stepForwardAndStrafe (btCollisionWorld* collisionWorld, const btVector3& walkMove); @@ -78,6 +78,17 @@ public: btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,btScalar stepHeight, int upAxis = 1); ~btKinematicCharacterController (); + + ///btActionInterface interface + virtual void updateAction( btCollisionWorld* collisionWorld,btScalar deltaTime) + { + preStep ( collisionWorld); + playerStep (collisionWorld, deltaTime); + } + + ///btActionInterface interface + void debugDraw(btIDebugDraw* debugDrawer); + void setUpAxis (int axis) { if (axis < 0) @@ -95,8 +106,8 @@ public: void reset (); void warp (const btVector3& origin); - void preStep ( btCollisionWorld* collisionWorld); - void playerStep (btCollisionWorld* collisionWorld, btScalar dt); + void preStep ( btCollisionWorld* collisionWorld); + void playerStep ( btCollisionWorld* collisionWorld, btScalar dt); void setFallSpeed (btScalar fallSpeed); void setJumpSpeed (btScalar jumpSpeed); diff --git a/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h b/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h index 78a770231..14cbe831b 100644 --- a/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h +++ b/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h @@ -30,7 +30,6 @@ enum btTypedConstraintType HINGE_CONSTRAINT_TYPE, CONETWIST_CONSTRAINT_TYPE, D6_CONSTRAINT_TYPE, - VEHICLE_CONSTRAINT_TYPE, SLIDER_CONSTRAINT_TYPE }; diff --git a/src/BulletDynamics/Dynamics/btActionInterface.h b/src/BulletDynamics/Dynamics/btActionInterface.h new file mode 100644 index 000000000..f8acca2a7 --- /dev/null +++ b/src/BulletDynamics/Dynamics/btActionInterface.h @@ -0,0 +1,39 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _BT_ACTION_INTERFACE_H +#define _BT_ACTION_INTERFACE_H + +class btIDebugDraw; +class btCollisionWorld; + +#include "LinearMath/btScalar.h" + +///Basic interface to allow actions such as vehicles and characters to be updated inside a btDynamicsWorld +class btActionInterface +{ + public: + + virtual ~btActionInterface() + { + } + + virtual void updateAction( btCollisionWorld* collisionWorld, btScalar deltaTimeStep)=0; + + virtual void debugDraw(btIDebugDraw* debugDrawer) = 0; + +}; + +#endif //_BT_ACTION_INTERFACE_H \ No newline at end of file diff --git a/src/BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp b/src/BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp index 19443adc7..fa0d63d74 100644 --- a/src/BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp +++ b/src/BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp @@ -90,8 +90,7 @@ void btContinuousDynamicsWorld::internalSingleStepSimulation( btScalar timeStep) integrateTransforms(timeStep * toi); ///update vehicle simulation - updateVehicles(timeStep); - + updateActions(timeStep); updateActivationState( timeStep ); diff --git a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp index ba48f4049..ea2e0ad2a 100644 --- a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp +++ b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp @@ -51,15 +51,7 @@ subject to the following restrictions: #include "LinearMath/btIDebugDraw.h" - -//vehicle -#include "BulletDynamics/Vehicle/btRaycastVehicle.h" -#include "BulletDynamics/Vehicle/btVehicleRaycaster.h" -#include "BulletDynamics/Vehicle/btWheelInfo.h" -//character -#include "BulletDynamics/Character/btCharacterControllerInterface.h" - -#include "LinearMath/btIDebugDraw.h" +#include "BulletDynamics/Dynamics/btActionInterface.h" #include "LinearMath/btQuickprof.h" #include "LinearMath/btMotionState.h" @@ -212,32 +204,11 @@ void btDiscreteDynamicsWorld::debugDrawWorld() } - for ( i=0;im_vehicles.size();i++) + if (getDebugDrawer() && getDebugDrawer()->getDebugMode()) { - for (int v=0;vgetNumWheels();v++) + for (i=0;igetWheelInfo(v).m_raycastInfo.m_isInContact) - { - wheelColor.setValue(0,0,255); - } else - { - wheelColor.setValue(255,0,255); - } - - btVector3 wheelPosWS = m_vehicles[i]->getWheelInfo(v).m_worldTransform.getOrigin(); - - btVector3 axle = btVector3( - m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[0][m_vehicles[i]->getRightAxis()], - m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[1][m_vehicles[i]->getRightAxis()], - m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[2][m_vehicles[i]->getRightAxis()]); - - - //m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_wheelAxleWS - //debug wheels (cylinders) - m_debugDrawer->drawLine(wheelPosWS,wheelPosWS+axle,wheelColor); - m_debugDrawer->drawLine(wheelPosWS,m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_contactPointWS,wheelColor); - + m_actions[i]->debugDraw(m_debugDrawer); } } } @@ -309,7 +280,7 @@ void btDiscreteDynamicsWorld::synchronizeMotionStates() synchronizeSingleMotionState(body); } } - +/* if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawWireframe) { for ( int i=0;im_vehicles.size();i++) @@ -321,6 +292,8 @@ void btDiscreteDynamicsWorld::synchronizeMotionStates() } } } + */ + } @@ -426,10 +399,8 @@ void btDiscreteDynamicsWorld::internalSingleStepSimulation(btScalar timeStep) integrateTransforms(timeStep); ///update vehicle simulation - updateVehicles(timeStep); + updateActions(timeStep); - updateCharacters(timeStep); - updateActivationState( timeStep ); if(0 != m_internalTickCallback) { @@ -493,29 +464,15 @@ void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body, short group, short } -void btDiscreteDynamicsWorld::updateVehicles(btScalar timeStep) +void btDiscreteDynamicsWorld::updateActions(btScalar timeStep) { - BT_PROFILE("updateVehicles"); + BT_PROFILE("updateActions"); - for ( int i=0;iupdateVehicle( timeStep); + m_actions[i]->updateAction( this, timeStep); } } - -void btDiscreteDynamicsWorld::updateCharacters(btScalar timeStep) -{ - BT_PROFILE("updateCharacters"); - - for ( int i=0;ipreStep (this); - character->playerStep (this,timeStep); - } -} - void btDiscreteDynamicsWorld::updateActivationState(btScalar timeStep) @@ -572,24 +529,35 @@ void btDiscreteDynamicsWorld::removeConstraint(btTypedConstraint* constraint) constraint->getRigidBodyB().removeConstraintRef(constraint); } -void btDiscreteDynamicsWorld::addVehicle(btRaycastVehicle* vehicle) +void btDiscreteDynamicsWorld::addAction(btActionInterface* action) { - m_vehicles.push_back(vehicle); + m_actions.push_back(action); } -void btDiscreteDynamicsWorld::removeVehicle(btRaycastVehicle* vehicle) +void btDiscreteDynamicsWorld::removeAction(btActionInterface* action) { - m_vehicles.remove(vehicle); + m_actions.remove(action); } -void btDiscreteDynamicsWorld::addCharacter(btCharacterControllerInterface* character) + +void btDiscreteDynamicsWorld::addVehicle(btActionInterface* vehicle) { - m_characters.push_back(character); + addAction(vehicle); } -void btDiscreteDynamicsWorld::removeCharacter(btCharacterControllerInterface* character) +void btDiscreteDynamicsWorld::removeVehicle(btActionInterface* vehicle) { - m_characters.remove(character); + removeAction(vehicle); +} + +void btDiscreteDynamicsWorld::addCharacter(btActionInterface* character) +{ + addAction(character); +} + +void btDiscreteDynamicsWorld::removeCharacter(btActionInterface* character) +{ + removeAction(character); } diff --git a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h index 34d4e6b35..7ba641cb5 100644 --- a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h +++ b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h @@ -23,10 +23,8 @@ class btOverlappingPairCache; class btConstraintSolver; class btSimulationIslandManager; class btTypedConstraint; +class btActionInterface; - -class btRaycastVehicle; -class btCharacterControllerInterface; class btIDebugDraw; #include "LinearMath/btAlignedObjectArray.h" @@ -52,12 +50,8 @@ protected: bool m_ownsIslandManager; bool m_ownsConstraintSolver; + btAlignedObjectArray m_actions; - btAlignedObjectArray m_vehicles; - - btAlignedObjectArray m_characters; - - int m_profileTimings; virtual void predictUnconstraintMotion(btScalar timeStep); @@ -70,9 +64,7 @@ protected: void updateActivationState(btScalar timeStep); - void updateVehicles(btScalar timeStep); - - void updateCharacters(btScalar timeStep); + void updateActions(btScalar timeStep); void startProfiling(btScalar timeStep); @@ -105,15 +97,10 @@ public: virtual void removeConstraint(btTypedConstraint* constraint); - virtual void addVehicle(btRaycastVehicle* vehicle); + virtual void addAction(btActionInterface*); - virtual void removeVehicle(btRaycastVehicle* vehicle); + virtual void removeAction(btActionInterface*); - virtual void addCharacter(btCharacterControllerInterface* character); - - virtual void removeCharacter(btCharacterControllerInterface* character); - - btSimulationIslandManager* getSimulationIslandManager() { return m_islandManager; @@ -130,6 +117,7 @@ public: } virtual void setGravity(const btVector3& gravity); + virtual btVector3 getGravity () const; virtual void addRigidBody(btRigidBody* body); @@ -171,6 +159,15 @@ public: (void) numTasks; } + ///obsolete, use addAction instead + virtual void addVehicle(btActionInterface* vehicle); + ///obsolete, use removeAction instead + virtual void removeVehicle(btActionInterface* vehicle); + ///obsolete, use addAction instead + virtual void addCharacter(btActionInterface* character); + ///obsolete, use removeAction instead + virtual void removeCharacter(btActionInterface* character); + }; #endif //BT_DISCRETE_DYNAMICS_WORLD_H diff --git a/src/BulletDynamics/Dynamics/btDynamicsWorld.h b/src/BulletDynamics/Dynamics/btDynamicsWorld.h index 2d90e212f..ecf7a2f0c 100644 --- a/src/BulletDynamics/Dynamics/btDynamicsWorld.h +++ b/src/BulletDynamics/Dynamics/btDynamicsWorld.h @@ -20,10 +20,10 @@ subject to the following restrictions: #include "BulletDynamics/ConstraintSolver/btContactSolverInfo.h" class btTypedConstraint; -class btRaycastVehicle; +class btActionInterface; class btConstraintSolver; class btDynamicsWorld; -class btCharacterControllerInterface; + /// Type for the callback for each tick typedef void (*btInternalTickCallback)(btDynamicsWorld *world, btScalar timeStep); @@ -72,14 +72,9 @@ public: virtual void removeConstraint(btTypedConstraint* constraint) {(void)constraint;} - virtual void addVehicle(btRaycastVehicle* vehicle) {(void)vehicle;} - - virtual void removeVehicle(btRaycastVehicle* vehicle) {(void)vehicle;} - - virtual void addCharacter(btCharacterControllerInterface* character) {(void)character;} - - virtual void removeCharacter(btCharacterControllerInterface* character) {(void)character;} + virtual void addAction(btActionInterface* action) = 0; + virtual void removeAction(btActionInterface* action) = 0; //once a rigidbody is added to the dynamics world, it will get this gravity assigned //existing rigidbodies in the world get gravity assigned too, during this method @@ -129,6 +124,16 @@ public: } + ///obsolete, use addAction instead. + virtual void addVehicle(btActionInterface* vehicle) {(void)vehicle;} + ///obsolete, use removeAction instead + virtual void removeVehicle(btActionInterface* vehicle) {(void)vehicle;} + ///obsolete, use addAction instead. + virtual void addCharacter(btActionInterface* character) {(void)character;} + ///obsolete, use removeAction instead + virtual void removeCharacter(btActionInterface* character) {(void)character;} + + }; #endif //BT_DYNAMICS_WORLD_H diff --git a/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp b/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp index 4982e6730..d9bb59092 100644 --- a/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp +++ b/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp @@ -19,15 +19,13 @@ #include "btVehicleRaycaster.h" #include "btWheelInfo.h" #include "LinearMath/btMinMax.h" - - +#include "LinearMath/btIDebugDraw.h" #include "BulletDynamics/ConstraintSolver/btContactConstraint.h" static btRigidBody s_fixedObject( 0,0,0); btRaycastVehicle::btRaycastVehicle(const btVehicleTuning& tuning,btRigidBody* chassis, btVehicleRaycaster* raycaster ) -: btTypedConstraint(VEHICLE_CONSTRAINT_TYPE), -m_vehicleRaycaster(raycaster), +:m_vehicleRaycaster(raycaster), m_pitchControl(btScalar(0.)) { m_chassisBody = chassis; @@ -704,6 +702,36 @@ void btRaycastVehicle::updateFriction(btScalar timeStep) } + +void btRaycastVehicle::debugDraw(btIDebugDraw* debugDrawer) +{ + + for (int v=0;vgetNumWheels();v++) + { + btVector3 wheelColor(0,255,255); + if (getWheelInfo(v).m_raycastInfo.m_isInContact) + { + wheelColor.setValue(0,0,255); + } else + { + wheelColor.setValue(255,0,255); + } + + btVector3 wheelPosWS = getWheelInfo(v).m_worldTransform.getOrigin(); + + btVector3 axle = btVector3( + getWheelInfo(v).m_worldTransform.getBasis()[0][getRightAxis()], + getWheelInfo(v).m_worldTransform.getBasis()[1][getRightAxis()], + getWheelInfo(v).m_worldTransform.getBasis()[2][getRightAxis()]); + + //debug wheels (cylinders) + debugDrawer->drawLine(wheelPosWS,wheelPosWS+axle,wheelColor); + debugDrawer->drawLine(wheelPosWS,getWheelInfo(v).m_raycastInfo.m_contactPointWS,wheelColor); + + } +} + + void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result) { // RayResultCallback& resultCallback; @@ -727,3 +755,4 @@ void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3& } return 0; } + diff --git a/src/BulletDynamics/Vehicle/btRaycastVehicle.h b/src/BulletDynamics/Vehicle/btRaycastVehicle.h index 7a8f69e12..4d17f5482 100644 --- a/src/BulletDynamics/Vehicle/btRaycastVehicle.h +++ b/src/BulletDynamics/Vehicle/btRaycastVehicle.h @@ -17,11 +17,12 @@ class btDynamicsWorld; #include "LinearMath/btAlignedObjectArray.h" #include "btWheelInfo.h" +#include "BulletDynamics/Dynamics/btActionInterface.h" class btVehicleTuning; ///rayCast vehicle, very special constraint that turn a rigidbody into a vehicle. -class btRaycastVehicle : public btTypedConstraint +class btRaycastVehicle : public btActionInterface { btAlignedObjectArray m_forwardWS; @@ -73,13 +74,24 @@ public: virtual ~btRaycastVehicle() ; - + + ///btActionInterface interface + virtual void updateAction( btCollisionWorld* collisionWorld, btScalar step) + { + updateVehicle(step); + } + + + ///btActionInterface interface + void debugDraw(btIDebugDraw* debugDrawer); + const btTransform& getChassisWorldTransform() const; btScalar rayCast(btWheelInfo& wheel); virtual void updateVehicle(btScalar step); - + + void resetSuspension(); btScalar getSteeringValue(int wheel) const; @@ -175,27 +187,6 @@ public: m_indexForwardAxis = forwardIndex; } - virtual void buildJacobian() - { - //not yet - } - - virtual void getInfo1 (btConstraintInfo1* info) - { - info->m_numConstraintRows = 0; - info->nub = 0; - } - - virtual void getInfo2 (btConstraintInfo2* info) - { - btAssert(0); - } - - virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep) - { - (void)timeStep; - //not yet - } };