예제 #1
0
void	ColladaDemo::initPhysics(const char* filename)
{
	m_cameraUp = btVector3(0,0,1);
	m_ele = 60;
	m_forwardAxis = 1;

	btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
	btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
	btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);

	btVector3 worldMin(-1000,-1000,-1000);
	btVector3 worldMax(1000,1000,1000);
	btBroadphaseInterface* pairCache = new btAxisSweep3(worldMin,worldMax);
	btConstraintSolver* constraintSolver = new btSequentialImpulseConstraintSolver();
	m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration);

	//m_dynamicsWorld = new btSimpleDynamicsWorld();

	m_dynamicsWorld->setDebugDrawer(&debugDrawer);
	

	MyColladaConverter* converter = new MyColladaConverter(this);

	bool result = converter->load(filename);
	if (result)
	{
		gColladaConverter = converter;
	} else
	{
		gColladaConverter = 0;
		printf("gColladaConverter = 0\n");
	}
}
예제 #2
0
void	ColladaDemo::initPhysics(const char* filename)
{
	m_cameraUp = SimdVector3(0,0,1);
	m_forwardAxis = 1;

	///Setup a Physics Simulation Environment
	CollisionDispatcher* dispatcher = new	CollisionDispatcher();
	SimdVector3 worldAabbMin(-10000,-10000,-10000);
	SimdVector3 worldAabbMax(10000,10000,10000);
	OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax);
	//BroadphaseInterface* broadphase = new SimpleBroadphase();
	m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
	m_physicsEnvironmentPtr->setDeactivationTime(2.f);
	m_physicsEnvironmentPtr->setGravity(0,0,-10);
	m_physicsEnvironmentPtr->setDebugDrawer(&debugDrawer);

	MyColladaConverter* converter = new MyColladaConverter(this);

	bool result = converter->load(filename);

	if (result)
	{
		result = converter->convert();
	}
	if (result)
	{
		gColladaConverter = converter;
	} else
	{
		gColladaConverter = 0;
	}
}