Ejemplo n.º 1
0
void	CPHIsland::	Step(dReal step)
{
	if(!m_flags.is_active()) return;
	//dWorldStepFast1	(DWorld(),	fixed_step,	phIterations/*+Random.randI(0,phIterationCycle)*/);
	if(m_flags.is_exact_integration_prefeared() && nj	<	max_joint_allowed_for_exeact_integration)
		dWorldStep(DWorld(),fixed_step);
	else
		dWorldQuickStep		(DWorld(),	fixed_step);
	//dWorldStep(DWorld(),fixed_step);
}
Ejemplo n.º 2
0
void CPHIsland::Enable()
{
	if(!m_flags.is_active()) return;

	for (dxBody  *body = DWorld()->firstbody; body; body = (dxBody *) body->next)body->flags &= ~dxBodyDisabled;
	
}
Ejemplo n.º 3
0
bool PhysicsEngine::Init(double dGravity, double dTimeStep,
                         double nMaxSubSteps){
  timestep_    = dTimeStep;
  gravity_acc_     = dGravity;
  time_max_substeps_ = nMaxSubSteps;

  // Physics stuff
  // See http://bulletphysics.org/mediawiki-1.5.8/index.php/Hello_World

  std::shared_ptr<btCollisionDispatcher> Dispatcher(
      new btCollisionDispatcher(&collision_configuration_) );
  bt_dispatcher_ = Dispatcher;

  std::shared_ptr<btDbvtBroadphase> Broadphase( new btDbvtBroadphase );
  bt_broadphase_ = Broadphase;

  std::shared_ptr<btSequentialImpulseConstraintSolver> Solver(
      new btSequentialImpulseConstraintSolver );
  bt_solver_ = Solver;
  std::shared_ptr<btDiscreteDynamicsWorld> DWorld(
      new btDiscreteDynamicsWorld(bt_dispatcher_.get(),
                                  bt_broadphase_.get(),
                                  bt_solver_.get(),
                                  &collision_configuration_) );
  dynamics_world_ = DWorld;
  dynamics_world_->setGravity( btVector3(0, 0,  gravity_acc_) );
  dynamics_world_->setDebugDrawer( &debug_drawer_ );
  dynamics_world_->getDebugDrawer()->
      setDebugMode(btIDebugDraw::DBG_DrawWireframe +
                   btIDebugDraw::DBG_FastWireframe +
                   btIDebugDraw::DBG_DrawConstraints);
  vehicle_raycaster_ = new btDefaultVehicleRaycaster(dynamics_world_.get());
  return true;
}