update build for btConvex2dShape functionality

use btDbvtBroadphase in HelloWorld demo, it is the recommended broadphase
This commit is contained in:
erwin.coumans
2009-09-17 20:17:14 +00:00
parent f65e829ca0
commit dcfb23dc13
5 changed files with 24 additions and 23 deletions

View File

@@ -23,8 +23,8 @@ subject to the following restrictions:
#include "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h"
///create 125 (5x5x5) dynamic object
#define ARRAY_SIZE_X 1
#define ARRAY_SIZE_Y 2
#define ARRAY_SIZE_X 15
#define ARRAY_SIZE_Y 15
#define ARRAY_SIZE_Z 1
//maximum number of objects (and allow user to shoot additional boxes)
@@ -218,7 +218,7 @@ void Box2dDemo::initPhysics()
btRigidBody::btRigidBodyConstructionInfo rbInfo(0,0,0);
switch (j%3)
{
#if 0
#if 1
case 0:
rbInfo = btRigidBody::btRigidBodyConstructionInfo(mass,myMotionState,colShape,localInertia);
break;
@@ -227,7 +227,7 @@ void Box2dDemo::initPhysics()
break;
#endif
default:
rbInfo = btRigidBody::btRigidBodyConstructionInfo(mass,myMotionState,colShape3,localInertia);
rbInfo = btRigidBody::btRigidBodyConstructionInfo(mass,myMotionState,colShape2,localInertia);
}
btRigidBody* body = new btRigidBody(rbInfo);
//body->setContactProcessingThreshold(colShape->getContactBreakingThreshold());
@@ -239,8 +239,8 @@ void Box2dDemo::initPhysics()
body->setActivationState(ISLAND_SLEEPING);
y += -0.8*deltaY;
//y += deltaY;
// y += -0.8*deltaY;
y += deltaY;
}
x += deltaX;

View File

@@ -22,11 +22,7 @@ OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY
ADD_EXECUTABLE(AppBox2dDemo
main.cpp
Box2dDemo.cpp
btBox2dBox2dCollisionAlgorithm.h
Box2dDemo.h
btBox2dShape.cpp
btBox2dBox2dCollisionAlgorithm.cpp
btBox2dShape.h
)

View File

@@ -30,12 +30,8 @@ int main(int argc, char** argv)
///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
///the maximum size of the collision world. Make sure objects stay within these boundaries
///Don't make the world AABB size too large, it will harm simulation quality and performance
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
int maxProxies = 1024;
btAxisSweep3* overlappingPairCache = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
///btDbvtBroadphase is a good general purpose broadphase. You can also try out btAxis3Sweep.
btBroadphaseInterface* overlappingPairCache = new btDbvtBroadphase();
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
@@ -173,3 +169,4 @@ int main(int argc, char** argv)
collisionShapes.clear();
}

View File

@@ -655,16 +655,16 @@ void VehicleDemo::updateCamera()
}
m_cameraPosition -= correctionFactor*camToObject;
//update OpenGL camera settings
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 10000.0);
btScalar aspect = m_glutScreenWidth / (btScalar)m_glutScreenHeight;
glFrustum (-aspect, aspect, -1.0, 1.0, 1.0, 10000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2],
m_cameraTargetPosition[0],m_cameraTargetPosition[1], m_cameraTargetPosition[2],
m_cameraUp.getX(),m_cameraUp.getY(),m_cameraUp.getZ());
m_cameraTargetPosition[0],m_cameraTargetPosition[1], m_cameraTargetPosition[2],
m_cameraUp.getX(),m_cameraUp.getY(),m_cameraUp.getZ());
}