more small refactoring: some methods were still upper-case.
This commit is contained in:
@@ -152,7 +152,7 @@ void CcdPhysicsDemo::clientMoveAndDisplay()
|
|||||||
btRigidBody::upcast(colObj)->getMotionState()->setWorldTransform(newTrans);
|
btRigidBody::upcast(colObj)->getMotionState()->setWorldTransform(newTrans);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
m_dynamicsWorld->getCollisionObjectArray()[0]->m_worldTransform.getOrigin() += kinTranslation;
|
m_dynamicsWorld->getCollisionObjectArray()[0]->getWorldTransform().getOrigin() += kinTranslation;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //USE_KINEMATIC_GROUND
|
#endif //USE_KINEMATIC_GROUND
|
||||||
@@ -258,8 +258,12 @@ void CcdPhysicsDemo::initPhysics()
|
|||||||
|
|
||||||
#ifdef REGISTER_CUSTOM_COLLISION_ALGORITHM
|
#ifdef REGISTER_CUSTOM_COLLISION_ALGORITHM
|
||||||
dispatcher->registerCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new btSphereSphereCollisionAlgorithm::CreateFunc);
|
dispatcher->registerCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new btSphereSphereCollisionAlgorithm::CreateFunc);
|
||||||
dispatcher->registerCollisionCreateFunc(BOX_SHAPE_PROXYTYPE,BOX_SHAPE_PROXYTYPE,new BoxBoxCollisionAlgorithm::CreateFunc);
|
//box-box is in Extras/AlternativeCollisionAlgorithms:it requires inclusion of those files
|
||||||
|
//dispatcher->registerCollisionCreateFunc(BOX_SHAPE_PROXYTYPE,BOX_SHAPE_PROXYTYPE,new BoxBoxCollisionAlgorithm::CreateFunc);
|
||||||
dispatcher->registerCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,TRIANGLE_SHAPE_PROXYTYPE,new btSphereTriangleCollisionAlgorithm::CreateFunc);
|
dispatcher->registerCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,TRIANGLE_SHAPE_PROXYTYPE,new btSphereTriangleCollisionAlgorithm::CreateFunc);
|
||||||
|
btSphereTriangleCollisionAlgorithm::CreateFunc* triangleSphereCF = new btSphereTriangleCollisionAlgorithm::CreateFunc;
|
||||||
|
triangleSphereCF->m_swapped = true;
|
||||||
|
dispatcher->registerCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,TRIANGLE_SHAPE_PROXYTYPE,triangleSphereCF);
|
||||||
#endif //REGISTER_CUSTOM_COLLISION_ALGORITHM
|
#endif //REGISTER_CUSTOM_COLLISION_ALGORITHM
|
||||||
|
|
||||||
#ifdef COMPARE_WITH_QUICKSTEP
|
#ifdef COMPARE_WITH_QUICKSTEP
|
||||||
@@ -361,8 +365,8 @@ void CcdPhysicsDemo::initPhysics()
|
|||||||
#ifdef USE_KINEMATIC_GROUND
|
#ifdef USE_KINEMATIC_GROUND
|
||||||
if (mass == 0.f)
|
if (mass == 0.f)
|
||||||
{
|
{
|
||||||
body->m_collisionFlags = btCollisionObject::CF_KINEMATIC_OJBECT;
|
body->setCollisionFlags( body->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
|
||||||
body->SetActivationState(DISABLE_DEACTIVATION);
|
body->setActivationState(DISABLE_DEACTIVATION);
|
||||||
}
|
}
|
||||||
#endif //USE_KINEMATIC_GROUND
|
#endif //USE_KINEMATIC_GROUND
|
||||||
|
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
|||||||
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
|
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
|
||||||
if (body)
|
if (body)
|
||||||
{
|
{
|
||||||
body->SetActivationState(ACTIVE_TAG);
|
body->setActivationState(ACTIVE_TAG);
|
||||||
btVector3 impulse = rayTo;
|
btVector3 impulse = rayTo;
|
||||||
impulse.normalize();
|
impulse.normalize();
|
||||||
float impulseStrength = 10.f;
|
float impulseStrength = 10.f;
|
||||||
@@ -562,7 +562,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
|||||||
if (!(body->isStaticObject() || body->isKinematicObject()))
|
if (!(body->isStaticObject() || body->isKinematicObject()))
|
||||||
{
|
{
|
||||||
pickedBody = body;
|
pickedBody = body;
|
||||||
pickedBody->SetActivationState(DISABLE_DEACTIVATION);
|
pickedBody->setActivationState(DISABLE_DEACTIVATION);
|
||||||
|
|
||||||
|
|
||||||
btVector3 pickPos = rayCallback.m_hitPointWorld;
|
btVector3 pickPos = rayCallback.m_hitPointWorld;
|
||||||
@@ -596,7 +596,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
|||||||
delete m_pickConstraint;
|
delete m_pickConstraint;
|
||||||
//printf("removed constraint %i",gPickingConstraintId);
|
//printf("removed constraint %i",gPickingConstraintId);
|
||||||
m_pickConstraint = 0;
|
m_pickConstraint = 0;
|
||||||
pickedBody->ForceActivationState(ACTIVE_TAG);
|
pickedBody->forceActivationState(ACTIVE_TAG);
|
||||||
pickedBody->setDeactivationTime( 0.f );
|
pickedBody->setDeactivationTime( 0.f );
|
||||||
pickedBody = 0;
|
pickedBody = 0;
|
||||||
}
|
}
|
||||||
@@ -699,7 +699,7 @@ void DemoApplication::renderme()
|
|||||||
wireColor = btVector3(0.f,0.0f,1.f);
|
wireColor = btVector3(0.f,0.0f,1.f);
|
||||||
}
|
}
|
||||||
///color differently for active, sleeping, wantsdeactivation states
|
///color differently for active, sleeping, wantsdeactivation states
|
||||||
if (colObj->GetActivationState() == 1) //active
|
if (colObj->getActivationState() == 1) //active
|
||||||
{
|
{
|
||||||
if (i & 1)
|
if (i & 1)
|
||||||
{
|
{
|
||||||
@@ -709,7 +709,7 @@ void DemoApplication::renderme()
|
|||||||
wireColor += btVector3 (.5f,0.f,0.f);
|
wireColor += btVector3 (.5f,0.f,0.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (colObj->GetActivationState() == 2) //ISLAND_SLEEPING
|
if (colObj->getActivationState() == 2) //ISLAND_SLEEPING
|
||||||
{
|
{
|
||||||
if (i & 1)
|
if (i & 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ subject to the following restrictions:
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/// September 2006: VehicleDemo is work in progress, this file is mostly just a placeholder
|
/// September 2006: VehicleDemo is work in progress, this file is mostly just a placeholder
|
||||||
/// This VehicleDemo file is very early in development, please check it later
|
/// This VehicleDemo file is very early in development, please check it later
|
||||||
|
|
||||||
@@ -164,7 +163,7 @@ const float TRIANGLE_SIZE=20.f;
|
|||||||
m_vehicle = new btRaycastVehicle(m_tuning,m_carChassis,m_vehicleRayCaster);
|
m_vehicle = new btRaycastVehicle(m_tuning,m_carChassis,m_vehicleRayCaster);
|
||||||
|
|
||||||
///never deactivate the vehicle
|
///never deactivate the vehicle
|
||||||
m_carChassis->SetActivationState(DISABLE_DEACTIVATION);
|
m_carChassis->setActivationState(DISABLE_DEACTIVATION);
|
||||||
|
|
||||||
m_dynamicsWorld->addVehicle(m_vehicle);
|
m_dynamicsWorld->addVehicle(m_vehicle);
|
||||||
|
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ static void SOR_LCP (int m, int nb, dRealMutablePtr J, int *jb, OdeSolverBody *
|
|||||||
void SolveInternal1 (float global_cfm,
|
void SolveInternal1 (float global_cfm,
|
||||||
float global_erp,
|
float global_erp,
|
||||||
OdeSolverBody* const *body, int nb,
|
OdeSolverBody* const *body, int nb,
|
||||||
BU_Joint * const *_joint,
|
BU_Joint **joint,
|
||||||
int nj,
|
int nj,
|
||||||
const btContactSolverInfo& solverInfo)
|
const btContactSolverInfo& solverInfo)
|
||||||
{
|
{
|
||||||
@@ -616,8 +616,8 @@ void SolveInternal1 (float global_cfm,
|
|||||||
// (the "BU_Joint *const*" declaration says we're allowed to modify the joints
|
// (the "BU_Joint *const*" declaration says we're allowed to modify the joints
|
||||||
// but not the joint array, because the caller might need it unchanged).
|
// but not the joint array, because the caller might need it unchanged).
|
||||||
//@@@ do we really need to do this? we'll be sorting constraint rows individually, not joints
|
//@@@ do we really need to do this? we'll be sorting constraint rows individually, not joints
|
||||||
BU_Joint **joint = (BU_Joint**) alloca (nj * sizeof(BU_Joint*));
|
//BU_Joint **joint = (BU_Joint**) alloca (nj * sizeof(BU_Joint*));
|
||||||
memcpy (joint,_joint,nj * sizeof(BU_Joint*));
|
//memcpy (joint,_joint,nj * sizeof(BU_Joint*));
|
||||||
|
|
||||||
// for all bodies, compute the inertia tensor and its inverse in the global
|
// for all bodies, compute the inertia tensor and its inverse in the global
|
||||||
// frame, and compute the rotational force and add it to the torque
|
// frame, and compute the rotational force and add it to the torque
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ struct btContactSolverInfo;
|
|||||||
void SolveInternal1 (float global_cfm,
|
void SolveInternal1 (float global_cfm,
|
||||||
float global_erp,
|
float global_erp,
|
||||||
OdeSolverBody * const *body, int nb,
|
OdeSolverBody * const *body, int nb,
|
||||||
BU_Joint * const *_joint, int nj, const btContactSolverInfo& info);
|
BU_Joint **_joint, int nj, const btContactSolverInfo& info);
|
||||||
|
|
||||||
int dRandInt2 (int n);
|
int dRandInt2 (int n);
|
||||||
|
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ bool btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionO
|
|||||||
printf("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
|
printf("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!body0->IsActive()) && (!body1->IsActive()))
|
if ((!body0->isActive()) && (!body1->isActive()))
|
||||||
needsCollision = false;
|
needsCollision = false;
|
||||||
|
|
||||||
return needsCollision ;
|
return needsCollision ;
|
||||||
|
|||||||
@@ -30,22 +30,22 @@ btCollisionObject::btCollisionObject()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btCollisionObject::SetActivationState(int newState)
|
void btCollisionObject::setActivationState(int newState)
|
||||||
{
|
{
|
||||||
if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION))
|
if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION))
|
||||||
m_activationState1 = newState;
|
m_activationState1 = newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void btCollisionObject::ForceActivationState(int newState)
|
void btCollisionObject::forceActivationState(int newState)
|
||||||
{
|
{
|
||||||
m_activationState1 = newState;
|
m_activationState1 = newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void btCollisionObject::activate()
|
void btCollisionObject::activate()
|
||||||
{
|
{
|
||||||
if (!(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OJBECT)))
|
if (!(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT)))
|
||||||
{
|
{
|
||||||
SetActivationState(ACTIVE_TAG);
|
setActivationState(ACTIVE_TAG);
|
||||||
m_deactivationTime = 0.f;
|
m_deactivationTime = 0.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
enum CollisionFlags
|
enum CollisionFlags
|
||||||
{
|
{
|
||||||
CF_STATIC_OBJECT= 1,
|
CF_STATIC_OBJECT= 1,
|
||||||
CF_KINEMATIC_OJBECT= 2,
|
CF_KINEMATIC_OBJECT= 2,
|
||||||
CF_NO_CONTACT_RESPONSE = 4,
|
CF_NO_CONTACT_RESPONSE = 4,
|
||||||
CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
|
CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
|
||||||
};
|
};
|
||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
inline bool mergesSimulationIslands() const
|
inline bool mergesSimulationIslands() const
|
||||||
{
|
{
|
||||||
///static objects, kinematic and object without contact response don't merge islands
|
///static objects, kinematic and object without contact response don't merge islands
|
||||||
return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OJBECT | CF_NO_CONTACT_RESPONSE) )==0);
|
return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE) )==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -99,12 +99,12 @@ public:
|
|||||||
|
|
||||||
inline bool isKinematicObject() const
|
inline bool isKinematicObject() const
|
||||||
{
|
{
|
||||||
return (m_collisionFlags & CF_KINEMATIC_OJBECT) != 0;
|
return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isStaticOrKinematicObject() const
|
inline bool isStaticOrKinematicObject() const
|
||||||
{
|
{
|
||||||
return (m_collisionFlags & (CF_KINEMATIC_OJBECT | CF_STATIC_OBJECT)) != 0 ;
|
return (m_collisionFlags & (CF_KINEMATIC_OBJECT | CF_STATIC_OBJECT)) != 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool hasContactResponse() const {
|
inline bool hasContactResponse() const {
|
||||||
@@ -133,9 +133,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int GetActivationState() const { return m_activationState1;}
|
int getActivationState() const { return m_activationState1;}
|
||||||
|
|
||||||
void SetActivationState(int newState);
|
void setActivationState(int newState);
|
||||||
|
|
||||||
void setDeactivationTime(float time)
|
void setDeactivationTime(float time)
|
||||||
{
|
{
|
||||||
@@ -146,13 +146,13 @@ public:
|
|||||||
return m_deactivationTime;
|
return m_deactivationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForceActivationState(int newState);
|
void forceActivationState(int newState);
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
|
|
||||||
inline bool IsActive() const
|
inline bool isActive() const
|
||||||
{
|
{
|
||||||
return ((GetActivationState() != ISLAND_SLEEPING) && (GetActivationState() != DISABLE_SIMULATION));
|
return ((getActivationState() != ISLAND_SLEEPING) && (getActivationState() != DISABLE_SIMULATION));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRestitution(float rest)
|
void setRestitution(float rest)
|
||||||
|
|||||||
@@ -166,11 +166,11 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
|||||||
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||||
if (colObj0->getIslandTag() == islandId)
|
if (colObj0->getIslandTag() == islandId)
|
||||||
{
|
{
|
||||||
if (colObj0->GetActivationState()== ACTIVE_TAG)
|
if (colObj0->getActivationState()== ACTIVE_TAG)
|
||||||
{
|
{
|
||||||
allSleeping = false;
|
allSleeping = false;
|
||||||
}
|
}
|
||||||
if (colObj0->GetActivationState()== DISABLE_DEACTIVATION)
|
if (colObj0->getActivationState()== DISABLE_DEACTIVATION)
|
||||||
{
|
{
|
||||||
allSleeping = false;
|
allSleeping = false;
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
|||||||
|
|
||||||
if (colObj0->getIslandTag() == islandId)
|
if (colObj0->getIslandTag() == islandId)
|
||||||
{
|
{
|
||||||
colObj0->SetActivationState( ISLAND_SLEEPING );
|
colObj0->setActivationState( ISLAND_SLEEPING );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -214,9 +214,9 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
|||||||
|
|
||||||
if (colObj0->getIslandTag() == islandId)
|
if (colObj0->getIslandTag() == islandId)
|
||||||
{
|
{
|
||||||
if ( colObj0->GetActivationState() == ISLAND_SLEEPING)
|
if ( colObj0->getActivationState() == ISLAND_SLEEPING)
|
||||||
{
|
{
|
||||||
colObj0->SetActivationState( WANTS_DEACTIVATION);
|
colObj0->setActivationState( WANTS_DEACTIVATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,17 +236,17 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
|||||||
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->getBody1());
|
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->getBody1());
|
||||||
|
|
||||||
//todo: check sleeping conditions!
|
//todo: check sleeping conditions!
|
||||||
if (((colObj0) && colObj0->GetActivationState() != ISLAND_SLEEPING) ||
|
if (((colObj0) && colObj0->getActivationState() != ISLAND_SLEEPING) ||
|
||||||
((colObj1) && colObj1->GetActivationState() != ISLAND_SLEEPING))
|
((colObj1) && colObj1->getActivationState() != ISLAND_SLEEPING))
|
||||||
{
|
{
|
||||||
//kinematic objects don't merge islands, but wake up all connected objects
|
//kinematic objects don't merge islands, but wake up all connected objects
|
||||||
if (colObj0->isKinematicObject() && colObj0->GetActivationState() != ISLAND_SLEEPING)
|
if (colObj0->isKinematicObject() && colObj0->getActivationState() != ISLAND_SLEEPING)
|
||||||
{
|
{
|
||||||
colObj1->SetActivationState(ACTIVE_TAG);
|
colObj1->setActivationState(ACTIVE_TAG);
|
||||||
}
|
}
|
||||||
if (colObj1->isKinematicObject() && colObj1->GetActivationState() != ISLAND_SLEEPING)
|
if (colObj1->isKinematicObject() && colObj1->getActivationState() != ISLAND_SLEEPING)
|
||||||
{
|
{
|
||||||
colObj0->SetActivationState(ACTIVE_TAG);
|
colObj0->setActivationState(ACTIVE_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
//filtering for response
|
//filtering for response
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ float maxdist2 = 1.e30f;
|
|||||||
|
|
||||||
#ifdef __SPU__
|
#ifdef __SPU__
|
||||||
#include <spu_printf.h>
|
#include <spu_printf.h>
|
||||||
|
#define printf spu_printf
|
||||||
#endif //__SPU__
|
#endif //__SPU__
|
||||||
|
|
||||||
btGjkPairDetector::btGjkPairDetector(btConvexShape* objectA,btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver* penetrationDepthSolver)
|
btGjkPairDetector::btGjkPairDetector(btConvexShape* objectA,btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver* penetrationDepthSolver)
|
||||||
@@ -133,6 +134,7 @@ void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result&
|
|||||||
if (curIter++ > gGjkMaxIter)
|
if (curIter++ > gGjkMaxIter)
|
||||||
{
|
{
|
||||||
#if defined(DEBUG) || defined (_DEBUG)
|
#if defined(DEBUG) || defined (_DEBUG)
|
||||||
|
|
||||||
printf("btGjkPairDetector maxIter exceeded:%i\n",curIter);
|
printf("btGjkPairDetector maxIter exceeded:%i\n",curIter);
|
||||||
printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n",
|
printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n",
|
||||||
m_cachedSeparatingAxis.getX(),
|
m_cachedSeparatingAxis.getX(),
|
||||||
@@ -141,6 +143,7 @@ void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result&
|
|||||||
squaredDistance,
|
squaredDistance,
|
||||||
m_minkowskiA->getShapeType(),
|
m_minkowskiA->getShapeType(),
|
||||||
m_minkowskiB->getShapeType());
|
m_minkowskiB->getShapeType());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ float btSequentialImpulseConstraintSolver::solve(btPersistentManifold* manifoldP
|
|||||||
for (int i=0;i<numpoints ;i++)
|
for (int i=0;i<numpoints ;i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
int j=i;
|
int j=i;//(i&1)? i : numpoints-1-i;
|
||||||
|
|
||||||
btManifoldPoint& cp = manifoldPtr->getContactPoint(j);
|
btManifoldPoint& cp = manifoldPtr->getContactPoint(j);
|
||||||
if (cp.getDistance() <= 0.f)
|
if (cp.getDistance() <= 0.f)
|
||||||
@@ -369,7 +369,7 @@ float btSequentialImpulseConstraintSolver::solveFriction(btPersistentManifold* m
|
|||||||
for (int i=0;i<numpoints ;i++)
|
for (int i=0;i<numpoints ;i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
int j=i;
|
int j=i;//(i&1)? i : numpoints-1-i;
|
||||||
|
|
||||||
btManifoldPoint& cp = manifoldPtr->getContactPoint(j);
|
btManifoldPoint& cp = manifoldPtr->getContactPoint(j);
|
||||||
if (cp.getDistance() <= 0.f)
|
if (cp.getDistance() <= 0.f)
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void btDiscreteDynamicsWorld::saveKinematicState(float timeStep)
|
|||||||
if (body)
|
if (body)
|
||||||
{
|
{
|
||||||
btTransform predictedTrans;
|
btTransform predictedTrans;
|
||||||
if (body->GetActivationState() != ISLAND_SLEEPING)
|
if (body->getActivationState() != ISLAND_SLEEPING)
|
||||||
{
|
{
|
||||||
if (body->isKinematicObject())
|
if (body->isKinematicObject())
|
||||||
{
|
{
|
||||||
@@ -123,7 +123,7 @@ void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
|||||||
if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawWireframe)
|
if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawWireframe)
|
||||||
{
|
{
|
||||||
btVector3 color(255.f,255.f,255.f);
|
btVector3 color(255.f,255.f,255.f);
|
||||||
switch(colObj->GetActivationState())
|
switch(colObj->getActivationState())
|
||||||
{
|
{
|
||||||
case ACTIVE_TAG:
|
case ACTIVE_TAG:
|
||||||
color = btVector3(255.f,255.f,255.f); break;
|
color = btVector3(255.f,255.f,255.f); break;
|
||||||
@@ -146,7 +146,7 @@ void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
|||||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
if (body && body->getMotionState() && !body->isStaticOrKinematicObject())
|
if (body && body->getMotionState() && !body->isStaticOrKinematicObject())
|
||||||
{
|
{
|
||||||
if (body->GetActivationState() != ISLAND_SLEEPING)
|
if (body->getActivationState() != ISLAND_SLEEPING)
|
||||||
{
|
{
|
||||||
btTransform interpolatedTransform;
|
btTransform interpolatedTransform;
|
||||||
btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(),
|
btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(),
|
||||||
@@ -302,12 +302,12 @@ void btDiscreteDynamicsWorld::updateActivationState(float timeStep)
|
|||||||
|
|
||||||
if (body->wantsSleeping())
|
if (body->wantsSleeping())
|
||||||
{
|
{
|
||||||
if (body->GetActivationState() == ACTIVE_TAG)
|
if (body->getActivationState() == ACTIVE_TAG)
|
||||||
body->SetActivationState( WANTS_DEACTIVATION );
|
body->setActivationState( WANTS_DEACTIVATION );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (body->GetActivationState() != DISABLE_DEACTIVATION)
|
if (body->getActivationState() != DISABLE_DEACTIVATION)
|
||||||
body->SetActivationState( ACTIVE_TAG );
|
body->setActivationState( ACTIVE_TAG );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,7 +435,7 @@ void btDiscreteDynamicsWorld::calculateSimulationIslands()
|
|||||||
if (((colObj0) && ((colObj0)->mergesSimulationIslands())) &&
|
if (((colObj0) && ((colObj0)->mergesSimulationIslands())) &&
|
||||||
((colObj1) && ((colObj1)->mergesSimulationIslands())))
|
((colObj1) && ((colObj1)->mergesSimulationIslands())))
|
||||||
{
|
{
|
||||||
if (colObj0->IsActive() || colObj1->IsActive())
|
if (colObj0->isActive() || colObj1->isActive())
|
||||||
{
|
{
|
||||||
|
|
||||||
getSimulationIslandManager()->getUnionFind().unite((colObj0)->getIslandTag(),
|
getSimulationIslandManager()->getUnionFind().unite((colObj0)->getIslandTag(),
|
||||||
@@ -512,7 +512,7 @@ void btDiscreteDynamicsWorld::updateAabbs()
|
|||||||
//something went wrong, investigate
|
//something went wrong, investigate
|
||||||
//this assert is unwanted in 3D modelers (danger of loosing work)
|
//this assert is unwanted in 3D modelers (danger of loosing work)
|
||||||
assert(0);
|
assert(0);
|
||||||
body->SetActivationState(DISABLE_SIMULATION);
|
body->setActivationState(DISABLE_SIMULATION);
|
||||||
|
|
||||||
static bool reportMe = true;
|
static bool reportMe = true;
|
||||||
if (reportMe)
|
if (reportMe)
|
||||||
@@ -547,7 +547,7 @@ void btDiscreteDynamicsWorld::integrateTransforms(float timeStep)
|
|||||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
if (body)
|
if (body)
|
||||||
{
|
{
|
||||||
if (body->IsActive() && (!body->isStaticOrKinematicObject()))
|
if (body->isActive() && (!body->isStaticOrKinematicObject()))
|
||||||
{
|
{
|
||||||
body->predictIntegratedTransform(timeStep, predictedTrans);
|
body->predictIntegratedTransform(timeStep, predictedTrans);
|
||||||
body->proceedToTransform( predictedTrans);
|
body->proceedToTransform( predictedTrans);
|
||||||
@@ -570,7 +570,7 @@ void btDiscreteDynamicsWorld::predictUnconstraintMotion(float timeStep)
|
|||||||
{
|
{
|
||||||
if (!body->isStaticOrKinematicObject())
|
if (!body->isStaticOrKinematicObject())
|
||||||
{
|
{
|
||||||
if (body->IsActive())
|
if (body->isActive())
|
||||||
{
|
{
|
||||||
body->applyForces( timeStep);
|
body->applyForces( timeStep);
|
||||||
body->integrateVelocities( timeStep);
|
body->integrateVelocities( timeStep);
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ public:
|
|||||||
|
|
||||||
inline void updateDeactivation(float timeStep)
|
inline void updateDeactivation(float timeStep)
|
||||||
{
|
{
|
||||||
if ( (GetActivationState() == ISLAND_SLEEPING) || (GetActivationState() == DISABLE_DEACTIVATION))
|
if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == DISABLE_DEACTIVATION))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((getLinearVelocity().length2() < gLinearSleepingThreshold*gLinearSleepingThreshold) &&
|
if ((getLinearVelocity().length2() < gLinearSleepingThreshold*gLinearSleepingThreshold) &&
|
||||||
@@ -261,7 +261,7 @@ public:
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
m_deactivationTime=0.f;
|
m_deactivationTime=0.f;
|
||||||
SetActivationState(0);
|
setActivationState(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -269,14 +269,14 @@ public:
|
|||||||
inline bool wantsSleeping()
|
inline bool wantsSleeping()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (GetActivationState() == DISABLE_DEACTIVATION)
|
if (getActivationState() == DISABLE_DEACTIVATION)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//disable deactivation
|
//disable deactivation
|
||||||
if (gDisableDeactivation || (gDeactivationTime == 0.f))
|
if (gDisableDeactivation || (gDeactivationTime == 0.f))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( (GetActivationState() == ISLAND_SLEEPING) || (GetActivationState() == WANTS_DEACTIVATION))
|
if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == WANTS_DEACTIVATION))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (m_deactivationTime> gDeactivationTime)
|
if (m_deactivationTime> gDeactivationTime)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ void btSimpleDynamicsWorld::updateAabbs()
|
|||||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
if (body)
|
if (body)
|
||||||
{
|
{
|
||||||
if (body->IsActive() && (!body->isStaticObject()))
|
if (body->isActive() && (!body->isStaticObject()))
|
||||||
{
|
{
|
||||||
btPoint3 minAabb,maxAabb;
|
btPoint3 minAabb,maxAabb;
|
||||||
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
|
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
|
||||||
@@ -134,7 +134,7 @@ void btSimpleDynamicsWorld::integrateTransforms(float timeStep)
|
|||||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
if (body)
|
if (body)
|
||||||
{
|
{
|
||||||
if (body->IsActive() && (!body->isStaticObject()))
|
if (body->isActive() && (!body->isStaticObject()))
|
||||||
{
|
{
|
||||||
body->predictIntegratedTransform(timeStep, predictedTrans);
|
body->predictIntegratedTransform(timeStep, predictedTrans);
|
||||||
body->proceedToTransform( predictedTrans);
|
body->proceedToTransform( predictedTrans);
|
||||||
@@ -155,7 +155,7 @@ void btSimpleDynamicsWorld::predictUnconstraintMotion(float timeStep)
|
|||||||
{
|
{
|
||||||
if (!body->isStaticObject())
|
if (!body->isStaticObject())
|
||||||
{
|
{
|
||||||
if (body->IsActive())
|
if (body->isActive())
|
||||||
{
|
{
|
||||||
body->applyForces( timeStep);
|
body->applyForces( timeStep);
|
||||||
body->integrateVelocities( timeStep);
|
body->integrateVelocities( timeStep);
|
||||||
@@ -176,7 +176,7 @@ void btSimpleDynamicsWorld::synchronizeMotionStates()
|
|||||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
if (body && body->getMotionState())
|
if (body && body->getMotionState())
|
||||||
{
|
{
|
||||||
if (body->GetActivationState() != ISLAND_SLEEPING)
|
if (body->getActivationState() != ISLAND_SLEEPING)
|
||||||
{
|
{
|
||||||
body->getMotionState()->setWorldTransform(body->getWorldTransform());
|
body->getMotionState()->setWorldTransform(body->getWorldTransform());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user