fixes in Bullet stuff, roll influence for raycast vehicles was broken,
authorErwin Coumans <blender@erwincoumans.com>
Tue, 29 Mar 2011 18:44:18 +0000 (18:44 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Tue, 29 Mar 2011 18:44:18 +0000 (18:44 +0000)
enable the setPhysicsTicRate for BGE Python

extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
extern/bullet2/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h

index 1a5619573680c7002d4cd284ed0fbc3f44e50df9..8af16b9cf6f3857bd4536326c72ca076f7b71ae9 100644 (file)
@@ -254,20 +254,21 @@ void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput& inpu
                        }
 #endif //
                        
-                       m_cachedSeparatingAxis = newCachedSeparatingAxis;
 
                        //redundant m_simplexSolver->compute_points(pointOnA, pointOnB);
 
                        //are we getting any closer ?
                        if (previousSquaredDistance - squaredDistance <= SIMD_EPSILON * previousSquaredDistance) 
                        { 
-                               m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
+//                             m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
                                checkSimplex = true;
                                m_degenerateSimplex = 12;
                                
                                break;
                        }
 
+                       m_cachedSeparatingAxis = newCachedSeparatingAxis;
+
                          //degeneracy, this is typically due to invalid/uninitialized worldtransforms for a btCollisionObject   
               if (m_curIter++ > gGjkMaxIter)   
               {   
@@ -294,7 +295,7 @@ void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput& inpu
                        if (!check)
                        {
                                //do we need this backup_closest here ?
-                               m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
+//                             m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
                                m_degenerateSimplex = 13;
                                break;
                        }
@@ -303,7 +304,7 @@ void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput& inpu
                if (checkSimplex)
                {
                        m_simplexSolver->compute_points(pointOnA, pointOnB);
-                       normalInB = pointOnA-pointOnB;
+                       normalInB = m_cachedSeparatingAxis;
                        btScalar lenSqr =m_cachedSeparatingAxis.length2();
                        
                        //valid normal
index 345dca6a11c9e3eb5cd3f4a52044929d536a79d0..5b467883d84555da7651eb821ab610b07751628c 100644 (file)
@@ -698,7 +698,7 @@ void        btRaycastVehicle::updateFriction(btScalar       timeStep)
                                        btVector3 sideImp = m_axle[wheel] * m_sideImpulse[wheel];
 
 #if defined ROLLING_INFLUENCE_FIX // fix. It only worked if car's up was along Y - VT.
-                                       btVector3 vChassisWorldUp = getRigidBody()->getCenterOfMassTransform().getBasis().getColumn(1);
+                                       btVector3 vChassisWorldUp = getRigidBody()->getCenterOfMassTransform().getBasis().getColumn(m_indexUpAxis);
                                        rel_pos -= vChassisWorldUp * (vChassisWorldUp.dot(rel_pos) * (1.f-wheelInfo.m_rollInfluence));
 #else
                                        rel_pos[m_indexUpAxis] *= wheelInfo.m_rollInfluence;
index 586e75d2d00a71964746fc19904392f9938cd465..51e00b9111f8bfbf4b655e6a5316f4d0b5c426c7 100644 (file)
@@ -125,7 +125,11 @@ protected:
                virtual void            debugDrawWorld();
 //             virtual bool            proceedDeltaTimeOneStep(float timeStep);
 
-               virtual void            setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep){};
+               virtual void            setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)
+               {
+                       //based on DEFAULT_PHYSICS_TIC_RATE of 60 hertz
+                       setNumTimeSubSteps(fixedTimeStep/60.f);
+               }
                //returns 0.f if no fixed timestep is used
 
                virtual float           getFixedTimeStep(){ return 0.f;};