updated bullet to version 2.64 and hopefully didn't break too much things in CcdPhysi...
authorDaniel Genrich <daniel.genrich@gmx.net>
Tue, 6 Nov 2007 14:27:06 +0000 (14:27 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Tue, 6 Nov 2007 14:27:06 +0000 (14:27 +0000)
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/implicit.c
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h

index 9720ec6b14150193daafcf81b41373caecdf6adb..3b065fc16f5f711134988d9ac0059d4316386cdc 100644 (file)
@@ -171,7 +171,7 @@ void cloth_init (ClothModifierData *clmd)
        // also from softbodies
        clmd->sim_parms.maxgoal = 1.0;
        clmd->sim_parms.mingoal = 0.0;
-       clmd->sim_parms.defgoal = 0.7;
+       clmd->sim_parms.defgoal = 0.0;
        clmd->sim_parms.goalspring = 100.0;
        clmd->sim_parms.goalfrict = 0.0;
 
index 41cc9e8cef47dce95ef5b373820095aaa791f162..a72887d7eb93b49f1e05eb416da94fb455875611 100644 (file)
@@ -2165,55 +2165,6 @@ void collisions_collision_moving_tris(ClothModifierData *clmd, ClothModifierData
        */
 }
 
-
-// move collision objects forward in time and update static bounding boxes
-void collisions_update_collision_objects(float step)
-{
-       Base *base=NULL;
-       ClothModifierData *coll_clmd=NULL;
-       Object *coll_ob=NULL;
-       unsigned int i=0;
-       /*
-       // search all objects for collision object
-       for (base = G.scene->base.first; base; base = base->next)
-       {
-
-               coll_ob = base->object;
-               coll_clmd = (ClothModifierData *) modifiers_findByType (coll_ob, eModifierType_Cloth);
-               if (!coll_clmd)
-                       continue;
-
-               // if collision object go on
-               if (coll_clmd->sim_parms.flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ)
-               {
-                       if (coll_clmd->clothObject && coll_clmd->clothObject->tree) 
-                       {
-                               Cloth *coll_cloth = coll_clmd->clothObject;
-                               BVH *coll_bvh = coll_clmd->clothObject->tree;
-                               unsigned int coll_numverts = coll_cloth->numverts;
-
-                               // update position of collision object
-                               for(i = 0; i < coll_numverts; i++)
-                               {
-                                       VECCOPY(coll_cloth->verts[i].txold, coll_cloth->verts[i].tx);
-
-                                       VECADDS(coll_cloth->verts[i].tx, coll_cloth->verts[i].xold, coll_cloth->verts[i].v, step);
-                                       
-                                       // no dt here because of float rounding errors
-                                       VECSUB(coll_cloth->verts[i].tv, coll_cloth->verts[i].tx, coll_cloth->verts[i].txold);
-                               }
-                               
-                               // update BVH of collision object
-                               // bvh_update(coll_clmd, coll_bvh, 0); // 0 means STATIC, 1 means MOVING 
-                       }
-                       else
-                               printf ("collisions_bvh_objcollision: found a collision object with clothObject or collData NULL.\n");
-               }
-       }
-       */
-}
-
-
 void collisions_collision_moving(ClothModifierData *clmd, ClothModifierData *coll_clmd, CollisionTree *tree1, CollisionTree *tree2)
 {
        /*
@@ -2251,7 +2202,7 @@ int cloth_bvh_objcollision(ClothModifierData * clmd, float step, float prevstep,
        ////////////////////////////////////////////////////////////
        // static collisions
        ////////////////////////////////////////////////////////////
-       /*
+       
        // update cloth bvh
        bvh_update_from_float3(bvh1, cloth->current_xold, cloth->numverts, cloth->current_x, 0); // 0 means STATIC, 1 means MOVING (see later in this function)
        
@@ -2276,6 +2227,8 @@ int cloth_bvh_objcollision(ClothModifierData * clmd, float step, float prevstep,
                        // fill collision list 
                        collisions += bvh_traverse(bvh1->root, bvh2->root, &collision_list);
                        
+                       // call static collision response
+                       
                        // free collision list
                        if(collision_list)
                        {
@@ -2303,7 +2256,7 @@ int cloth_bvh_objcollision(ClothModifierData * clmd, float step, float prevstep,
                VECADD(cloth->current_x[i], cloth->current_xold[i], cloth->current_v[i]);
        }
        //////////////////////////////////////////////
-       */
+       
        // Test on *simple* selfcollisions
        collisions = 1;
        count = 0;
index 47d8f186653027364df4f3f0a03a0af82ec9bae6..01289113bf151d380b69bf2f10c56aed1f72b692 100644 (file)
@@ -307,7 +307,7 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename,
                case UseBullet:
                        {
                                CcdPhysicsEnvironment* ccdPhysEnv = new CcdPhysicsEnvironment();
-                               ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw());
+                               // ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw());
                                ccdPhysEnv->setDeactivationLinearTreshold(0.8f); // default, can be overridden by Python
                                ccdPhysEnv->setDeactivationAngularTreshold(1.0f); // default, can be overridden by Python
 
index 99c3e5f77c7bb44d83776c8d2b34c6b2506573cf..db82dde9663974dc49bcf851088fedc6900e9117 100644 (file)
@@ -295,7 +295,7 @@ static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVec
 
 
 
-CcdPhysicsEnvironment::CcdPhysicsEnvironment(btDispatcher* dispatcher,btOverlappingPairCache* pairCache)
+CcdPhysicsEnvironment::CcdPhysicsEnvironment(btDispatcher* dispatcher,btBroadphaseInterface* broadphase)
 :m_scalingPropagated(false),
 m_numIterations(10),
 m_numTimeSubSteps(1),
@@ -303,32 +303,31 @@ m_ccdMode(0),
 m_solverType(-1),
 m_profileTimings(0),
 m_enableSatCollisionDetection(false)
-{
-
+{      
        for (int i=0;i<PHY_NUM_RESPONSE;i++)
        {
                m_triggerCallbacks[i] = 0;
        }
        if (!dispatcher)
-               dispatcher = new btCollisionDispatcher();
+               dispatcher = new btCollisionDispatcher(new btDefaultCollisionConfiguration());
 
 
-       if(!pairCache)
+       if(!broadphase)
        {
 
                //todo: calculate/let user specify this world sizes
                btVector3 worldMin(-10000,-10000,-10000);
                btVector3 worldMax(10000,10000,10000);
-
-               pairCache = new btAxisSweep3(worldMin,worldMax);
-
+               
+               broadphase = new btAxisSweep3(worldMin,worldMax);
+               
                //broadphase = new btSimpleBroadphase();
        }
 
 
        setSolverType(1);//issues with quickstep and memory allocations
 
-       m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,pairCache,new btSequentialImpulseConstraintSolver());
+       m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,new btSequentialImpulseConstraintSolver(),new btDefaultCollisionConfiguration());
        m_debugDrawer = 0;
        m_gravity = btVector3(0.f,-10.f,0.f);
        m_dynamicsWorld->setGravity(m_gravity);
@@ -620,7 +619,7 @@ int                 CcdPhysicsEnvironment::createUniversalD6Constraint(
 
                genericConstraint = new btGeneric6DofConstraint(
                        *rb0,*rb1,
-                       frameInA,frameInB);
+                       frameInA,frameInB, 1);
                genericConstraint->setLinearLowerLimit(linearMinLimits);
                genericConstraint->setLinearUpperLimit(linearMaxLimits);
                genericConstraint->setAngularLowerLimit(angularMinLimits);
@@ -687,8 +686,8 @@ struct      FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResul
                //ignore client...
                if (curHit != m_ignoreClient)
                {               
-                       //if valid
-                       return ClosestRayResultCallback::AddSingleResult(rayResult);
+                       //if valid; also return normal in world space
+                       return ClosestRayResultCallback::AddSingleResult(rayResult, 1);
                }
                return m_closestHitFraction;
        }
@@ -805,7 +804,7 @@ void        CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float
                {
                        //param = 1..12, min0,max0,min1,max1...min6,max6
                        btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint;
-                       genCons->SetLimit(param,value0,value1);
+                       genCons->setLimit(param,value0,value1);
                        break;
                };
        default:
@@ -1099,7 +1098,7 @@ int                       CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
                                
                                genericConstraint = new btGeneric6DofConstraint(
                                        *rb0,*rb1,
-                                       frameInA,frameInB);
+                                       frameInA,frameInB, 1);
 
 
                        } else
@@ -1122,7 +1121,7 @@ int                       CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
 
                                genericConstraint = new btGeneric6DofConstraint(
                                        *rb0,s_fixedObject2,
-                                       frameInA,frameInB);
+                                       frameInA,frameInB, 1);
                        }
                        
                        if (genericConstraint)
index 66a6ed59c17cb436274c736befd6e8db64e7c8ae..8d2b961db85edd6ca9b806685dc589000b4fa33c 100644 (file)
@@ -71,7 +71,7 @@ protected:
        
 
        public:
-               CcdPhysicsEnvironment(btDispatcher* dispatcher=0, btOverlappingPairCache* pairCache=0);
+               CcdPhysicsEnvironment(btDispatcher* dispatcher=0, btBroadphaseInterface* broadphase=0);
 
                virtual         ~CcdPhysicsEnvironment();