more work on hashed pairmanager. growing doesn't work yet, so need to allocate enough room for the overlapping pairs in advance.
boxbox reports contact point in B, rather then average point box, cylinder use halfextents corrected for scaling and margin. made the margin in this halfextents explicit in the 'getHalfExtentsWithMargin' and 'getHalfExtentsWithoutMargin' integrated changed for ODE quickstep solver replaced inline with SIMD_FORCE_INLINE some minor optimizations in the btSequentialImpulseConstraintSolver added cone drawing (for X,Y,Z cones)
This commit is contained in:
@@ -20,8 +20,8 @@ subject to the following restrictions:
|
||||
//Note: some of those settings need 'DO_WALL' demo
|
||||
//#define USE_KINEMATIC_GROUND 1
|
||||
//#define PRINT_CONTACT_STATISTICS 1
|
||||
//#define REGISTER_CUSTOM_COLLISION_ALGORITHM 1
|
||||
//#define REGISTER_BOX_BOX 1 //needs to be used in combination with REGISTER_CUSTOM_COLLISION_ALGORITHM
|
||||
#define REGISTER_CUSTOM_COLLISION_ALGORITHM 1
|
||||
#define REGISTER_BOX_BOX 1 //needs to be used in combination with REGISTER_CUSTOM_COLLISION_ALGORITHM
|
||||
//#define USER_DEFINED_FRICTION_MODEL 1
|
||||
//#define USE_CUSTOM_NEAR_CALLBACK 1
|
||||
//#define CENTER_OF_MASS_SHIFT 1
|
||||
@@ -121,13 +121,13 @@ btCollisionShape* shapePtr[numShapes] =
|
||||
#ifdef DO_BENCHMARK_PYRAMIDS
|
||||
new btBoxShape (btVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)),
|
||||
#else
|
||||
new btCylinderShape (btVector3(CUBE_HALF_EXTENTS-gCollisionMargin,CUBE_HALF_EXTENTS-gCollisionMargin,CUBE_HALF_EXTENTS-gCollisionMargin)),
|
||||
//new btCylinderShape (btVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)),
|
||||
#endif
|
||||
|
||||
//new btSphereShape (CUBE_HALF_EXTENTS),
|
||||
//new btCapsuleShape(0.5*CUBE_HALF_EXTENTS-gCollisionMargin,CUBE_HALF_EXTENTS-gCollisionMargin),
|
||||
//new btCapsuleShape(0.5*CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS),
|
||||
//new btCylinderShape (btVector3(1-gCollisionMargin,CUBE_HALF_EXTENTS-gCollisionMargin,1-gCollisionMargin)),
|
||||
//new btConeShape(CUBE_HALF_EXTENTS-gCollisionMargin,2.f*CUBE_HALF_EXTENTS-gCollisionMargin),
|
||||
new btConeShapeX(CUBE_HALF_EXTENTS,2.f*CUBE_HALF_EXTENTS),
|
||||
|
||||
new btSphereShape (CUBE_HALF_EXTENTS),
|
||||
|
||||
@@ -446,7 +446,9 @@ int maxNumOutstandingTasks = 4;//number of maximum outstanding tasks
|
||||
solver->setSolverMode(btSequentialImpulseConstraintSolver::SOLVER_RANDMIZE_ORDER);
|
||||
#endif //USER_DEFINED_FRICTION_MODEL
|
||||
|
||||
m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver);
|
||||
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver);
|
||||
m_dynamicsWorld = world;
|
||||
// world->getSolverInfo().m_numIterations = 4;
|
||||
m_dynamicsWorld->getDispatchInfo().m_enableSPU = true;
|
||||
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
||||
|
||||
|
||||
@@ -286,8 +286,8 @@ btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollision
|
||||
{
|
||||
for (int i=0;i<10;i++)
|
||||
{
|
||||
//btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1));
|
||||
btCollisionShape* colShape = new btCapsuleShape(0.5,2.0);//boxShape = new btSphereShape(1.f);
|
||||
btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1));
|
||||
//btCollisionShape* colShape = new btCapsuleShape(0.5,2.0);//boxShape = new btSphereShape(1.f);
|
||||
startTransform.setOrigin(btVector3(2*i,10,1));
|
||||
localCreateRigidBody(1, startTransform,colShape);
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
||||
case BOX_SHAPE_PROXYTYPE:
|
||||
{
|
||||
const btBoxShape* boxShape = static_cast<const btBoxShape*>(shape);
|
||||
btVector3 halfExtent = boxShape->getHalfExtents();
|
||||
btVector3 halfExtent = boxShape->getHalfExtentsWithMargin();
|
||||
glScaled(2*halfExtent[0], 2*halfExtent[1], 2*halfExtent[2]);
|
||||
glutSolidCube(1.0);
|
||||
useWireframeFallback = false;
|
||||
@@ -412,9 +412,24 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
||||
case CONE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
const btConeShape* coneShape = static_cast<const btConeShape*>(shape);
|
||||
int upIndex = coneShape->getConeUpIndex();
|
||||
float radius = coneShape->getRadius();//+coneShape->getMargin();
|
||||
float height = coneShape->getHeight();//+coneShape->getMargin();
|
||||
//glRotatef(-90.0, 1.0, 0.0, 0.0);
|
||||
switch (upIndex)
|
||||
{
|
||||
case 0:
|
||||
glRotatef(90.0, 0.0, 1.0, 0.0);
|
||||
break;
|
||||
case 1:
|
||||
glRotatef(-90.0, 1.0, 0.0, 0.0);
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
glTranslatef(0.0, 0.0, -0.5*height);
|
||||
glutSolidCone(radius,height,10,10);
|
||||
useWireframeFallback = false;
|
||||
@@ -435,7 +450,7 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
||||
|
||||
|
||||
float radius = cylinder->getRadius();
|
||||
float halfHeight = cylinder->getHalfExtents()[upAxis];
|
||||
float halfHeight = cylinder->getHalfExtentsWithMargin()[upAxis];
|
||||
|
||||
drawCylinder(radius,halfHeight,upAxis);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user