void CModAPI_WorldEvent_Explosion::Send(vec2 Pos, int Owner, int Weapon, int MaxDamage) { CModAPI_WorldEvent_ExplosionEffect::Send(Pos); // deal damage CCharacter *apEnts[MAX_CLIENTS]; float Radius = g_pData->m_Explosion.m_Radius; float InnerRadius = 48.0f; float MaxForce = g_pData->m_Explosion.m_MaxForce; if(WorldID() == MOD_WORLD_ALL) { for(int w=0; w<MOD_NUM_WORLDS; w++) { int Num = GameServer()->m_World[w].FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, MOD_ENTTYPE_CHARACTER); for(int i = 0; i < Num; i++) { vec2 Diff = apEnts[i]->GetPos() - Pos; vec2 Force(0, MaxForce); float l = length(Diff); if(l) Force = normalize(Diff) * MaxForce; float Factor = 1 - clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f); apEnts[i]->TakeDamage(Force * Factor, (int)(Factor * MaxDamage), Owner, Weapon); } } } else { int Num = GameServer()->m_World[WorldID()].FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, MOD_ENTTYPE_CHARACTER); for(int i = 0; i < Num; i++) { vec2 Diff = apEnts[i]->GetPos() - Pos; vec2 Force(0, MaxForce); float l = length(Diff); if(l) Force = normalize(Diff) * MaxForce; float Factor = 1 - clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f); apEnts[i]->TakeDamage(Force * Factor, (int)(Factor * MaxDamage), Owner, Weapon); } } }
void Ship::decelerate() { if (abs(toMagnitude(velocity)) > frame.getAccel()) { apply(Force(Angle(getRotation() + 180), (float)frame.engineForce())); } else { stop(); } }
Force Force::operator -(const Force& i_f) const { if (m_unit == i_f.m_unit) { return Force(m_unit, m_value[0]-i_f.m_value[0], m_value[1]-i_f.m_value[1], m_value[1]-i_f.m_value[1]) ; } }
void Ship::shoot(float angle = 0, Chunk<Entity>* chunk=NULL) { Projectile test_projectile(20, 10000); sf::Vector2f pos(getPosition().x + cosf(TO_RADIANS * angle) * getGlobalBounds().width * 1.5f, getPosition().y + sinf(TO_RADIANS * angle) * getGlobalBounds().height * 1.5f); test_projectile.setOrigin(test_projectile.getCenter()); test_projectile.setPosition(pos); test_projectile.apply(Force(Angle(angle), 1.0f)); test_projectile.setTexture(Board<Entity>::texture_map.get("projectile")); chunk->add(std::make_shared<Projectile>(test_projectile)); shooting = false; }
void setupScene(){ std::cout<<"Initializing scene..."<<std::endl; std::cout.precision(5); //Set up Lighting Stuff glLightfv(GL_LIGHT0, GL_POSITION, left_light_position); glLightfv(GL_LIGHT0, GL_SPECULAR, white_light); glLightfv(GL_LIGHT1, GL_POSITION, right_light_position); glLightfv(GL_LIGHT1, GL_SPECULAR, white_light); glEnable(GL_LIGHT0); glEnable(GL_LIGHT1); glLightfv(GL_LIGHT0, GL_DIFFUSE, white_light); glLightfv(GL_LIGHT1, GL_DIFFUSE, white_light); glShadeModel(GL_SMOOTH); glEnable(GL_NORMALIZE); glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); //CODIIIIO Vector random; for (int i = 0 ; i<NUMCUBES; i++){ random.x = ((int)rand()%2 == 0 ? (float)rand() / RAND_MAX : -(float)rand() / RAND_MAX ) *6; random.y = ((int)rand()%2 == 0 ? (float)rand() / RAND_MAX : -(float)rand() / RAND_MAX ) *6; random.z = ((int)rand()%2 == 0 ? (float)rand() / RAND_MAX : -(float)rand() / RAND_MAX ) *6; collection.push_back(Body(random)); } //forces.push_back(Vector(-0.001,0.0,0.0));//wind forces.push_back(Force(Vector(0.0,0.0,0.0)));//not //forces.push_back(Vector(0.0,-0.09,0.0));//ok 0.15; gravity force for (int i=0;i< collection.size(); i++) std::cout << collection.at(i).angularVelocity << std::endl; int i=0; }
void MaterialPointSet::Update(double deltaTime) { BeforeStep(deltaTime); for (unsigned int i = 0; i < m_count; ++i) { if (m_bounds[i] == false) m_points[i].PrepareMove(deltaTime, Force(i)); } AfterStep(deltaTime); for (unsigned int i = 0; i < m_count; ++i) { if (m_bounds[i] == false) m_points[i].UpdateMove(); } }
int main() { // Initialize the controls // Constructor is ModelerControl(name, minimumvalue, maximumvalue, stepsize, defaultvalue) ModelerControl controls[NUMCONTROLS]; controls[XPOS] = ModelerControl("X Position", -5, 5, 0.1f, 0); controls[YPOS] = ModelerControl("Y Position", 0, 5, 0.1f, 0); controls[ZPOS] = ModelerControl("Z Position", -5, 5, 0.1f, 0); controls[RIGHTARMX] = ModelerControl("Right Arm Angle X", 0, 360, 1, 0); controls[RIGHTARMY] = ModelerControl("Right Arm Angle Y", 0, 360, 1, 0); controls[RIGHTARMZ] = ModelerControl("Right Arm Angle Z", 0, 360, 1, 0); controls[RIGHTELBOWX] = ModelerControl("Right Elbow Angle X", 0, 180, 1, 0); controls[RIGHTELBOWY] = ModelerControl("Spin Right Elbow", 0, 360, 1, 0); controls[RIGHTHANDX] = ModelerControl("Right Hand Angle X", 90, -90, 1, 0); controls[LEFTARMX] = ModelerControl("Left Arm Angle X", 0, 360, 1, 0); controls[LEFTARMY] = ModelerControl("Left Arm Angle Y", 0, 360, 1, 0); controls[LEFTARMZ] = ModelerControl("Left Arm Angle Z", 0, 360, 1, 0); controls[LEFTELBOWX] = ModelerControl("Left Elbow Angle X", 0, 180, 1, 0); controls[LEFTELBOWY] = ModelerControl("Spin Left Elbow", 0, 360, 1, 0); controls[LEFTHANDX] = ModelerControl("Left Hand Angle X", 90, -90, 1, 0); controls[LEFTLEGX] = ModelerControl("Left Leg Angle X", -60, 60, 1, 0); controls[LEFTLEGZ] = ModelerControl("Left Leg Angle Z", -80, 80, 1, 0); controls[RIGHTLEGX] = ModelerControl("Right Leg Angle X", -60, 60, 1, 0); controls[RIGHTLEGZ] = ModelerControl("Right Leg Angle Z", -80, 80, 1, 0); controls[LEFTKNEE] = ModelerControl("Left Knee", 0, 15, 1, 0); controls[RIGHTKNEE] = ModelerControl("Right Knee", 0, 15, 1, 0); controls[TAILMOVEMENT] = ModelerControl("Tail Movement", 0, 100, 1, 0); controls[METABALLSKIN] = ModelerControl("Metaball Skin", 0, 1, 1, 0); controls[TEXTURESKIN] = ModelerControl("Texture Skin", 0, 1, 1, 0); controls[NINJATURTLE] = ModelerControl("Ninja Turtle", 0, 1, 1, 0); controls[EYEBANDANA] = ModelerControl("Eye Bandana", 0, 1, 1, 0); ModelerApplication::Instance()->Init(&createSampleModel, controls, NUMCONTROLS); // Hooking up the particle system ParticleSystem *ps = new ParticleSystem(); ps->addFieldForce(Force(0.0, -1.0, 0.0)); ModelerApplication::Instance()->SetParticleSystem(ps); return ModelerApplication::Instance()->Run(); }
int main() { const int n = 500; // Number of atoms, molecules const int mt = 1000; // Max time steps const int dtxyz = 100; // Time interval to output xyz int i, j; double *x, *v, *f; const double domain = 600; // Domain size (a.u.) const double dt = 10; // Time interval (a.u.) const double ms = 0.00001; // Max speed (a.u.) const double em = 1822.88839 * 28.0134; // Effective mass of N2 const double lje = 0.000313202; // Lennard-Jones epsilon of N2 const double ljs = 6.908841465; // Lennard-Jones sigma of N2 x = (double *) malloc(n * 3 * sizeof(double)); v = (double *) malloc(n * 3 * sizeof(double)); f = (double *) malloc(n * 3 * sizeof(double)); // Initialization for (i=0; i<n; i++) for (j=0; j<3; j++) x[i*3+j] = domain * rand() / (RAND_MAX + 1.0); for (i=0; i<n; i++) for (j=0; j<3; j++) v[i*3+j] = ms * (rand() / (RAND_MAX + 1.0) - 0.5); // Dynamics for (i=0; i<mt; i++) { Force(n, lje, ljs, x, f); Solver(n, dt, em, x, v, f); //Output_energy(i, n, dt, em, lje, ljs, x, v); //if (i % dtxyz == 0) Output_xyz(i, n, x); } //Output_xyz(i, n, x); return 0; }
void IntegrateBerendsen(void) { double U,F,NewVelocity; double Ekin, tau = 0.01, Berendsen, Stoch=0, Scale, lambda; // Integration of equations of motion: Leap Frog. Force(Position,&U,&F); //determine lambda Ekin = Velocity*Velocity //begin modification //end modification lambda = sqrt((Ekin + Scale)/Ekin); NewVelocity=lambda*(Velocity+Tstep*F); Position+=Tstep*NewVelocity; // Conserved quantity is v(t) = (Vpos + Vnew)/2. // We square them, so we need a factor 8. ConservedEnergy=U+SQR(NewVelocity+Velocity)/8.0; Velocity=NewVelocity; OldF=F; }
///\The big mama method :) //********************************************************************************** void Simulator::run() { double newTime = (float(clock()))/CLOCKS_PER_SEC; if( newTime > lastRealTime + 1 ) { realtime = (time-lastTime)/(newTime-lastRealTime); lastTime = time; lastRealTime = newTime; updated = true; } vector< Robot* >::iterator itr1; done = true; //1) First We run the AI and update the sensors itr1= robots.begin(); for( ; itr1 != robots.end(); itr1++ ) { //update sensors map< int, Sensor>::iterator sitr = (*itr1)->sensors.begin(); for( ; sitr != (*itr1)->sensors.end(); sitr++ ) { serviceSensor( *itr1, sitr->second ); } //give each robot a chance to think. #ifdef DEBUGROBOT (*itr1)->print(); #endif if( !((*itr1)->AI->process( time )) ) done = false; // check for termination } //2) Then each mobile has its forces calculated itr1= robots.begin(); for( ; itr1 != robots.end(); itr1++ ) { Robot *r((*itr1) ); Location2t loc = (*itr1)->loc; if( loc.point.x < 0 ) r-> applyForce( Force( loc.point, Vector2( 100,0 ))); if( loc.point.x > w ) r-> applyForce( Force( loc.point, Vector2( -100,0 ))); if( loc.point.y < 0 ) r-> applyForce( Force( loc.point, Vector2( 0,100 ))); if( loc.point.y >h ) r-> applyForce( Force( loc.point, Vector2( 0,-100 ))); //add a little fluid friction //using f=-b(v)^2 b = 0.1 Vector2 friction = -0.1*sqrt(loc.momentum.dot(loc.momentum))*loc.momentum/r->mass/r->mass; if( friction.mag() > 100 ) cout << "F:" << friction.mag() << endl; Force test(loc.point,friction); r-> applyForce( test); //also some rotational friction double rtorque = -1*fabs(loc.angularMomentum)*loc.angularMomentum/(*itr1)->moment/(*itr1)->moment; r-> applyForce( Force( loc.point+Vector2(0.5,0), Vector2( 0, rtorque))); r-> applyForce( Force( loc.point+Vector2(-0.5,0), Vector2( 0, -rtorque))); //now check for collistions vector< Entity* >::iterator itr2 =entities.begin() ; for( ; itr2 != entities.end(); itr2++ ) { if( (*itr2)->getType() == Entity::kWall && *itr2 != r ) { double range; Vector2 where = (*itr2)->getShape()->closest( loc.point, &range ); if( range < r->radius ) { //force = k * radius/range //cout <<"Range:"<< range << endl; double force = 1000*(r->radius-range) / range ; //cout << "Force:"<< force << endl; Vector2 direction = loc.point - where; //cout << where.y-loc.point.y << endl; direction = direction/direction.mag(); //if( direction.y != 0 ) // cout << "Dy" <<direction.y << endl; //cout << "Direction:" << direction.x << ',' << direction.y << endl; r-> applyForce( Force( where, force*direction) ); } } } } //Now update the robots physical position itr1= robots.begin(); for( ; itr1 != robots.end(); itr1++ ) { //cout << "here\n"; (*itr1)->updateTo( step, time ); //(*itr1)->print(); } time += step; }
Force Force::Newton(const float& i_x, const float& i_y, const float& i_z) { return Force(_Newton,i_x,i_y,i_z) ; }
void Ship::accelerate() { apply(Force(Angle(getRotation()), (float)frame.engineForce())); }
/**读入缝*/ bool Garment::readSeam(char * loc){ int sizeCloth = allCloth.size()/2; for(int i = 0;i < sizeCloth/2; i ++){ for(int j = 0; j < allCloth.at(i).massCloth.size();j ++){ allCloth.at(i*2).getVectorMass()->at(j)->seamForce = Force(0,0,-SEAMFORCE); allCloth.at(i*2 + 1).getVectorMass()->at(j)->seamForce = Force(0,0,SEAMFORCE); // } } for(int i = 0;i < sizeCloth; i ++){ for(int j = 0; j < allCloth.at(2*i).massSeam.size();j ++){ allCloth.at(2*i).massSeam.at(j)->seamMassPoint=(allCloth.at(2*i+1).massSeam.at(j)); allCloth.at(2*i).massSeam.at(j)->seamForce = Force(0,0,-SEAMFORCE); allCloth.at(2*i+1).massSeam.at(j)->seamMassPoint=(allCloth.at(2*i).massSeam.at(j)); allCloth.at(2*i+1).massSeam.at(j)->seamForce = Force(0,0,SEAMFORCE); Spring *tmpSring = new Spring(1,allCloth.at(2*i).massSeam.at(j)); tmpSring->setConnectedMass(allCloth.at(2*i+1).massSeam.at(j)); allCloth.at(2*i).massSeam.at(j)->massSpring.push_back(tmpSring); allCloth.at(2*i).massSeam.at(j)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(2*i+1).massSeam.at(j)); tmpSring->setConnectedMass(allCloth.at(2*i).massSeam.at(j)); allCloth.at(2*i+1).massSeam.at(j)->massSpring.push_back(tmpSring); allCloth.at(2*i+1).massSeam.at(j)->massSpring.push_back(tmpSring); // } } //for(int i = 0;i < sizeCloth; i ++){ // for(int j = 0; j < allCloth.at(2*i).massSeam1.size();j ++){ // allCloth.at(2*i).massSeam1.at(j)->setSeamPoint(allCloth.at(2*i+1).massSeam1.at(j)); // allCloth.at(2*i+1).massSeam1.at(j)->setSeamPoint(allCloth.at(2*i).massSeam1.at(j)); // } //} int sizearmwidth = allCloth.at(2).massSeam1.size(); int bodysize =allCloth.at(0).massSeam1.size()/2; for(int i = 0;i < sizearmwidth; i ++){ /*allCloth.at(0).massSeam1.at(i)->setSeamPoint(allCloth.at(2).massSeam1.at(i)); allCloth.at(0).massSeam1.at(i+bodysize)->setSeamPoint(allCloth.at(4).massSeam1.at(i));*/ Spring *tmpSring = new Spring(1,allCloth.at(0).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(2).massSeam1.at(i)); allCloth.at(0).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(0).massSeam1.at(i)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(0).massSeam1.at(i+bodysize)); tmpSring->setConnectedMass(allCloth.at(4).massSeam1.at(i)); allCloth.at(0).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); allCloth.at(0).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); /*allCloth.at(2).massSeam1.at(i)->setSeamPoint(allCloth.at(0).massSeam1.at(i)); allCloth.at(4).massSeam1.at(i)->setSeamPoint(allCloth.at(0).massSeam1.at(i+bodysize));*/ tmpSring = new Spring(1,allCloth.at(2).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(0).massSeam1.at(i)); allCloth.at(2).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(2).massSeam1.at(i)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(4).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(0).massSeam1.at(i+bodysize)); allCloth.at(4).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(4).massSeam1.at(i)->massSpring.push_back(tmpSring); /*allCloth.at(1).massSeam1.at(i)->setSeamPoint(allCloth.at(3).massSeam1.at(i)); allCloth.at(1).massSeam1.at(i+bodysize)->setSeamPoint(allCloth.at(5).massSeam1.at(i));*/ tmpSring = new Spring(1,allCloth.at(1).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(3).massSeam1.at(i)); allCloth.at(1).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(1).massSeam1.at(i)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(1).massSeam1.at(i+bodysize)); tmpSring->setConnectedMass(allCloth.at(5).massSeam1.at(i)); allCloth.at(1).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); allCloth.at(1).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); /*allCloth.at(3).massSeam1.at(i)->setSeamPoint(allCloth.at(1).massSeam1.at(i)); allCloth.at(5).massSeam1.at(i)->setSeamPoint(allCloth.at(1).massSeam1.at(i+bodysize));*/ tmpSring = new Spring(1,allCloth.at(3).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(1).massSeam1.at(i)); allCloth.at(3).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(3).massSeam1.at(i)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(5).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(1).massSeam1.at(i+bodysize)); allCloth.at(5).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(5).massSeam1.at(i)->massSpring.push_back(tmpSring); } //sizearmwidth = bodysize -sizearmwidth; for(int i = sizearmwidth;i < bodysize; i ++){ allCloth.at(0).massSeam1.at(i)->setSeamPoint(allCloth.at(1).massSeam1.at(i)); allCloth.at(0).massSeam1.at(i+bodysize)->setSeamPoint(allCloth.at(1).massSeam1.at(i+bodysize)); allCloth.at(0).massSeam1.at(i)->seamForce = Force(0,0,-SEAMFORCE); allCloth.at(0).massSeam1.at(i+bodysize)->seamForce = Force(0,0,-SEAMFORCE); allCloth.at(1).massSeam1.at(i)->setSeamPoint(allCloth.at(0).massSeam1.at(i)); allCloth.at(1).massSeam1.at(i+bodysize)->setSeamPoint(allCloth.at(0).massSeam1.at(i+bodysize)); allCloth.at(1).massSeam1.at(i)->seamForce = Force(0,0,SEAMFORCE); allCloth.at(1).massSeam1.at(i+bodysize)->seamForce = Force(0,0,SEAMFORCE); Spring *tmpSring = new Spring(1,allCloth.at(0).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(1).massSeam1.at(i)); allCloth.at(0).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(0).massSeam1.at(i)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(0).massSeam1.at(i+bodysize)); tmpSring->setConnectedMass(allCloth.at(1).massSeam1.at(i+bodysize)); allCloth.at(0).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); allCloth.at(0).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(1).massSeam1.at(i)); tmpSring->setConnectedMass(allCloth.at(0).massSeam1.at(i)); allCloth.at(1).massSeam1.at(i)->massSpring.push_back(tmpSring); allCloth.at(1).massSeam1.at(i)->massSpring.push_back(tmpSring); tmpSring = new Spring(1,allCloth.at(1).massSeam1.at(i+bodysize)); tmpSring->setConnectedMass(allCloth.at(0).massSeam1.at(i+bodysize)); allCloth.at(1).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); allCloth.at(1).massSeam1.at(i+bodysize)->massSpring.push_back(tmpSring); } return true; }
void SpaceSim::TakeInput() { al_get_keyboard_state(&new_keyboard_state); //ESCAPE if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_ESCAPE)) { done = true; } Entity* spaceship_body = spaceship->getEntity("body"); PositionComp* spaceship_body_pos = (PositionComp*) spaceship_body->getComponent("Position"); PhysicsComp* spaceship_body_physiscs = (PhysicsComp*)spaceship_body->getComponent("Physics"); //WASD if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_W)) { Entity* thruster_main_entity = spaceship->getEntity("thruster_main"); PositionComp* thruster_main_pos = (PositionComp*) thruster_main_entity->getComponent("Position"); ThrusterComp* thruster_main = (ThrusterComp*)thruster_main_entity->getComponent("Thruster"); ConnectedComp* thruster_main_connected = (ConnectedComp*)thruster_main_entity->getComponent("Connected"); spaceship_body_physiscs->addForce(Force(thruster_main_connected->getRadianFromSocket()+spaceship_body_pos->getRotation(), thruster_main_pos->getRotation(), thruster_main->getForceExerted())); } if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_D)) { Entity* thruster_east_entity = spaceship->getEntity("thruster_east"); PositionComp* thruster_east_pos = (PositionComp*) thruster_east_entity->getComponent("Position"); ThrusterComp* thruster_east = (ThrusterComp*)thruster_east_entity->getComponent("Thruster"); ConnectedComp* thruster_east_connected = (ConnectedComp*)thruster_east_entity->getComponent("Connected"); spaceship_body_physiscs->addForce(Force(thruster_east_connected->getRadianFromSocket()+spaceship_body_pos->getRotation(), thruster_east_pos->getRotation(), thruster_east->getForceExerted())); } if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_S)) { } if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_A)) { Entity* thruster_west_entity = spaceship->getEntity("thruster_west"); PositionComp* thruster_west_pos = (PositionComp*) thruster_west_entity->getComponent("Position"); ThrusterComp* thruster_west = (ThrusterComp*)thruster_west_entity->getComponent("Thruster"); ConnectedComp* thruster_west_connected = (ConnectedComp*)thruster_west_entity->getComponent("Connected"); spaceship_body_physiscs->addForce(Force(thruster_west_connected->getRadianFromSocket()+spaceship_body_pos->getRotation(), thruster_west_pos->getRotation(), thruster_west->getForceExerted())); } //ARROW KEYS if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_UP)) { if(!al_key_down(&old_keyboard_state,ALLEGRO_KEY_UP)) { Entity* north_turret_entity = spaceship->getEntity("turret_north"); PositionComp* north_turret_pos = (PositionComp*) north_turret_entity->getComponent("Position"); TurretComp* north_turret = (TurretComp*) north_turret_entity->getComponent("Turret"); Entity* bullet = new Entity(); physics_entities.push_back(bullet); entities.push_back(bullet); //We need to allow space betweent he turret and the bullet so they dont collide double x_position = (15.0*cos(north_turret_pos->getRotation())) + north_turret_pos->getPosition().x; double y_position = (15.0*sin(north_turret_pos->getRotation())) + north_turret_pos->getPosition().y; PositionComp* bullet_pos = new PositionComp(Vector3(x_position,y_position,16)); bullet->addComponent(bullet_pos); bullet->addComponent(new SpriteComp(bullet_bitmap,bullet_pos)); bullet->addComponent(new BulletComp(north_turret->getBulletArmorPiercing())); //bullet->addComponent(new RemovalComp(3,false,bullet)); PhysicsComp* bullet_phys =new PhysicsComp(north_turret->getBulletWeight(),al_get_bitmap_width(bullet_bitmap)/2,.1,bullet_pos); double bullet_direction = north_turret_pos->getRotation(); double bullet_degrees = bullet_direction*57.2957795; bullet_phys->addForce(Force(bullet_direction+PI,bullet_direction, north_turret->getBulletForce())); bullet->addComponent(bullet_phys); } } if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_RIGHT)) { if(!al_key_down(&old_keyboard_state,ALLEGRO_KEY_RIGHT)) { } } if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_DOWN)) { } if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_LEFT)) { if(!al_key_down(&old_keyboard_state,ALLEGRO_KEY_LEFT)) { } } ////Q //if(al_key_down(&new_keyboard_state,ALLEGRO_KEY_Q)) //{ // if(!al_key_down(&old_keyboard_state,ALLEGRO_KEY_Q)) // { // player_sprite->setBitmap(dead_bitmap); // } //} ////Player fuel stats //double fuel_cost =player_astronaut->getFuelCost(); //double current_co2 = player_astronaut->getCurrentCO2(); ////W //current_co2 = player_astronaut->getCurrentCO2(); //if(current_co2 > fuel_cost*1000*dt && al_key_down(&new_keyboard_state,ALLEGRO_KEY_W)) //{ // thrust_animated->setToVisible(); // player_physics->addForce(Force(player_position->getRotation()+PI,player_position->getRotation(),1000)); // if(!al_get_sample_instance_playing(co2_sample_instance)) // { // al_play_sample_instance(co2_sample_instance); // } // player_astronaut->setCurrentCO2(current_co2 - (fuel_cost*1000)*dt ); //} //else //{ // thrust_animated->setToInvisible(); // al_stop_sample_instance(co2_sample_instance); //} ////S //current_co2 = player_astronaut->getCurrentCO2(); //if(current_co2 > fuel_cost*1000*dt && al_key_down(&new_keyboard_state,ALLEGRO_KEY_S)) //{ // double current_co2 = player_astronaut->getCurrentCO2(); // thrust_back_animated->setToVisible(); // player_physics->addForce(Force(player_position->getRotation(),player_position->getRotation()+PI,1000)); // if(!al_get_sample_instance_playing(co2_sample_instance)) // { // al_play_sample_instance(co2_back_sample_instance); // } // player_astronaut->setCurrentCO2(current_co2 - (fuel_cost*1000)*dt ); //} //else //{ // thrust_back_animated->setToInvisible(); // al_stop_sample_instance(co2_back_sample_instance); //} ////D //current_co2 = player_astronaut->getCurrentCO2(); //if(current_co2 > fuel_cost*500*dt && al_key_down(&new_keyboard_state,ALLEGRO_KEY_D)) //{ // thrust_right_animated->setToVisible(); // player_physics->addForce(Force(player_position->getRotation()-(PI/2.0),player_position->getRotation(),500)); // if(!al_get_sample_instance_playing(co2_right_sample_instance)) // { // al_play_sample_instance(co2_right_sample_instance); // } // player_astronaut->setCurrentCO2(current_co2 - (fuel_cost*500)*dt ); //} //else //{ // thrust_right_animated->setToInvisible(); // al_stop_sample_instance(co2_right_sample_instance); //} ////A //current_co2 = player_astronaut->getCurrentCO2(); //if(current_co2 > fuel_cost*500*dt && al_key_down(&new_keyboard_state,ALLEGRO_KEY_A)) //{ // thrust_left_animated->setToVisible(); // player_physics->addForce(Force(player_position->getRotation()+(PI/2.0),player_position->getRotation(),500)); // if(!al_get_sample_instance_playing(co2_sample_instance)) // { // al_play_sample_instance(co2_left_sample_instance); // } // player_astronaut->setCurrentCO2(current_co2 - (fuel_cost*500)*dt ); //} //else //{ // thrust_left_animated->setToInvisible(); // al_stop_sample_instance(co2_left_sample_instance); //} old_keyboard_state = new_keyboard_state; }
int main() { const int n = 500; // Number of atoms, molecules const int mt = 100; // Max time steps const int dtxyz = 100; // Time interval to output xyz int i; int j; double *x; double *v; double *f; const double domain = 300; // Domain size (a.u.) const double dt = 10; // Time interval (a.u.) const double ms = 0.00001; // Max speed (a.u.) const double em = 1822.88839 * 28.0134; // Effective mass of N2 const double lje = 0.000313202; // Lennard-Jones epsilon of N2 const double ljs = 6.908841465; // Lennard-Jones sigma of N2 #ifdef MKLRNG VSLStreamStatePtr stream; vslNewStream(&stream, VSL_BRNG_MT19937, 5489); // Initiation, type, seed //vslNewStream(&stream, VSL_BRNG_SFMT19937, 5489); // Initiation, type, seed #endif x = (double *) malloc(n * 3 * sizeof(double)); v = (double *) malloc(n * 3 * sizeof(double)); f = (double *) malloc(n * 3 * sizeof(double)); // Initialization #ifdef MKLRNG for (i=0; i<n; i++) { int nRN = 3; double GRN[3]; vdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2, stream, nRN, GRN, 0.5 * domain, domain); for (j=0; j<3; j++) x[i*3+j] = GRN[j]; vdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2, stream, nRN, GRN, 0.0, 0.5 * ms); for (j=0; j<3; j++) v[i*3+j] = GRN[j]; } #else for (i=0; i<n; i++) for (j=0; j<3; j++) x[i*3+j] = domain * rand() / (RAND_MAX + 1.0); for (i=0; i<n; i++) for (j=0; j<3; j++) v[i*3+j] = ms * (rand() / (RAND_MAX + 1.0) - 0.5); #endif // Dynamics for (i=0; i<mt; i++) { Force(n, lje, ljs, x, f); Solver(n, dt, em, x, v, f); Output_energy(i, n, dt, em, lje, ljs, x, v); if (i % dtxyz == 0) Output_xyz(i, n, x); } Output_xyz(i, n, x); return 0; }
// by convention, (radius, phi, theta) Force Force::toSpherical() const { return Force(this->toSphericals()); }
void RigidSphere::addForce(double dir, double vDir, double spd) { velocity += Force(dir, vDir, spd).buildVector(); }
NS_IMETHODIMP Touch::GetForce(float* aForce) { *aForce = Force(); return NS_OK; }
Force Force::toCylindrical() const { return Force(this->toCylindrical()); }
void SqlStatement::Force() const { Force(SQL); }
void ontimertSystemClockTimer(){ // timer for calculations of the dynamic system model double pedal, power, brakeForce, frictionForce, accelarationForce; double correspondingEngineSpeed, ratio; setTimer(this,kDeltaT); pedal = @sysvar::PowerTrain::PedalPosition; if (pedal<5) { // idle running power = 5 * 1.5; } else { power = pedal * 1.5; } gEngSpeed = CalcEngSpeed(gSpeed, $GearBoxInfo::Gear, pedal, @sysvar::PowerTrain::EngineRunningPowerTrain); gForce = Force(power, $GearBoxInfo::Gear, @sysvar::PowerTrain::EngineRunningPowerTrain); frictionForce = (kAirFriction*gSpeed*gSpeed) + ( 1.0 * gSpeed ) + kRollingFrictivoid on;() if (@sysvar::PowerTrain::BrakeActive == 1) { brakeForce = 10000.0; } else { brakeForce = 0.0; } accelarationForce = gForce - frictionForce - brakeForce; //////////////////////// // differential equation //////////////////////// // workaround for error if( accelarationForce != 0.0 ) { gSpeed = gSpeed + (( accelarationForce / kMass) * kDeltaTInSec); // oldSpeed = gSpeed; } // reset idle indicator if( accelarationForce >= -1.0 ) { gPowerIdle = 0; } //////////////////////// // check stationary condition //////////////////////// if (gSpeed<=0) gSpeed = 0.0; if (@sysvar::PowerTrain::EngineRunningPowerTrain) { if ( $GearBoxInfo::Gear!=0) { correspondingEngineSpeed = CalcEngSpeed(gSpeed,$GearBoxInfo::Gear, pedal, @sysvar::PowerTrain::EngineRunningPowerTrain); ratio = EngSpeedToSpeedRatio($GearBoxInfo::Gear); gSpeed = correspondingEngineSpeed / ratio; } // assign to messages $EngineData::EngSpeed = (gEngSpeed * 75.0); $EngineData::EngForce = gForce; $EngineData::EngPower = power; $EngineDataIEEE::EngSpeedIEEE = (gEngSpeed * 75.0); $EngineDataIEEE::EngForceIEEE = gForce; } $ABSdata::CarSpeed = (gSpeed * 1.6); $ABSdata::AccelarationForce = accelarationForce; }
int main(int argc, char *argv[]) { std::string dirname = PZSOURCEDIR; #ifdef LOG4CXX InitializePZLOG(); #endif gRefDBase.InitializeRefPatterns(); TPZReadGIDGrid readGid; TPZGeoMesh *gmesh = readGid.GeometricGIDMesh("../rail.dump"); { std::ofstream out("../GmeshOrig.vtk"); TPZVTKGeoMesh::PrintGMeshVTK(gmesh, out); } InsertBoundaryElements(gmesh); // CASO NAO TEM TRILHO 2 SwitchBCTrilho2(gmesh); AddZZeroFaces(gmesh); RefineGMesh(gmesh); { std::ofstream out("../GmeshRef.vtk"); TPZVTKGeoMesh::PrintGMeshVTK(gmesh, out); } const int porder = 2; TPZCompMesh * cmesh = ComputationalElasticityMesh3D(gmesh,porder); AdaptPOrders(cmesh, -400., 2); // toto // { // std::set<int> mats; // mats.insert(bcbottom); // TPZManVector<STATE> force(1,0.); // force = cmesh->Integrate("StressZ", mats); // std::cout << "force = " << force << std::endl; // } { std::ofstream out("../CmeshRef.vtk"); TPZVTKGeoMesh::PrintCMeshVTK(cmesh, out); } { TPZFMatrix<STATE> visualf; cmesh->ComputeFillIn(150, visualf); VisualMatrix(visualf,"../VisualMatrixBefore.vtk"); } TPZAnalysis an; TPZAutoPointer<TPZRenumbering> renumber; // renumber = new TPZSloan; // renumber = new TPZCutHillMcKee; renumber = new TPZMetis; an.SetRenumber(renumber); an.SetCompMesh(cmesh, true); #ifdef PZDEBUG { std::ofstream out("../gmesh.txt"); gmesh->Print(out); } { std::ofstream out("../cmesh.txt"); cmesh->Print(out); } #endif { TPZFMatrix<STATE> visualf; cmesh->ComputeFillIn(150, visualf); VisualMatrix(visualf,"../MatrixMetis.vtk"); } std::cout << "NEquations " << an.Solution().Rows() << std::endl; SolveSist(&an,cmesh); std::set<int> mats; mats.insert(bcbottom); TPZManVector<STATE> Force(1,0.); Force = cmesh->Integrate("StressZ", mats); std::cout << "Integrated sigma_Z " << Force << std::endl; std::cout << "Post processing" << std::endl; PostProcessElasticity(an, "../postProc.vtk"); std::cout << "Finished\n"; // delete cmesh; // delete gmesh; return EXIT_SUCCESS; }
bool objects_init(Map_Settings mSettings) { // Load_Menu_Textures(); SDL_ShowCursor(false); char szfm1path[256]; char szobjpath[256]; char sztexpath[256]; /* chemins vers les objets 3D */ strcpy(szobjpath, g_exepath); strcat(szobjpath, "objects"PATHDELIM_S); /* chemins vers les textures */ strcpy(sztexpath, g_exepath); strcat(sztexpath, "textures"PATHDELIM_S); /* chargement d'un objet Graine */ g_ObjsSeed = new C3DObjElements ; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"seed.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsSeed->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsSeed->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, &g_matDefault); g_ObjsSeed->m_lowRes = 0 ; /* chargement d'un objet Fourmi Récolteuse générique */ g_ObjsHarvester = new C3DObjElements; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"minor.fm1"); if (!C3DObjLoader::Load3d(szfm1patPATHDELIMh,&g_ObjsHarvester->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsHarvester->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, &g_matSeed); /* chargement d'un objet Fourmi Récolteuse générique */ strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"minor-lowres.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsHarvester->m_lowRes, AnimNameUID, ObjNameUID)) return false; g_ObjsHarvester->m_lowRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, NULL); /* chargement d'un objet Herbe Type 1 */ g_ObjsWeed1 = new C3DObjElements; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"weed1.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsWeed1->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsWeed1->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, NULL); g_ObjsWeed1->m_lowRes = NULL; /* chargement d'un objet Herbe Type 2 */ g_ObjsWeed2 = new C3DObjElements; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"weed2.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsWeed2->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsWeed2->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, NULL); g_ObjsWeed2->m_lowRes = NULL; /* chargement d'un objet Champignon*/ g_ObjsMushroom = new C3DObjElements; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"mushroom.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsMushroom->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsMushroom->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, NULL); g_ObjsMushroom->m_lowRes = NULL; /* chargement d'un objet Fleur Rouge*/ g_ObjsRedFlower = new C3DObjElements; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"redflower.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsRedFlower->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsRedFlower->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, NULL); g_ObjsRedFlower->m_lowRes = NULL; /* chargement d'un objet Araignée*/ g_ObjsSpider = new C3DObjElements; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"spider.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsSpider->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsSpider->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, NULL); g_ObjsSpider->m_lowRes = NULL; /* chargement d'un objet Major*/ g_ObjsMajor = new C3DObjElements; strcpy(szfm1path, g_exepath); strcat(szfm1path, "objects"PATHDELIM_S"major.fm1"); if (!C3DObjLoader::Load3d(szfm1path,&g_ObjsMajor->m_hiRes, AnimNameUID, ObjNameUID)) return false; g_ObjsMajor->m_hiRes->Load(szobjpath, sztexpath, true, &g_textures_list, &g_objects_list, NULL); g_ObjsMajor->m_lowRes = NULL; //g_ObjsMajor->m_hiRes->SelectDefaultAnimation(ANIMATION_WALK_UID); //g_ObjsMajor->m_hiRes->ChangeFrameRateRatio(4); /* CVector3f grav (0,-0.8f,0); CVector3f randplan (0.0f, 0.0f, 0.0f); CVector3f randspeed (0.3f, 0.8f, 0.4f);*/ /*g_ObjsMajor->m_hiRes->InitParticleSystem(OBJECT_SHOOTPARTICLE_UID, 20.0f, 20, 5.0f, 1.0f, 0.3f, 1.0f, 0.3f, 0.8f, false,0, 0.5f,0.5f, grav, randplan, randspeed, NULL,NULL); g_ObjsMajor->m_hiRes->Reset();*/ //g_ObjsMajor->m_hiRes->StartParticleSystem(); init_world(world,"AI_test.wld", mSettings); // minor.load3d(); /* initialisation des objets par copie */ /* g_ObjGraine = new C3DObjElement; *(g_ObjGraine) = *(ObjGraine); g_ObjGraine->ChangeFrameRateRatio(10.0); g_ObjFourmi1 = new C3DObjElement; *(g_ObjFourmi1) = *(ObjOuvriere); g_ObjFourmi1->ChangeFrameRateRatio(40.0); g_ObjFourmi1->SelectDefaultAnimation(ANIMATION_STAY_UID); g_ObjFourmi1->RandomAnimationStart(ANIMATION_STAY_UID); g_ObjFourmi2 = new C3DObjElement; *(g_ObjFourmi2) = *(ObjOuvriere); g_ObjFourmi2->ChangeFrameRateRatio(10.0); g_ObjFourmi2->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi2->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi3 = new C3DObjElement; *(g_ObjFourmi3) = *(ObjOuvriere); g_ObjFourmi3->ChangeFrameRateRatio(10.0); g_ObjFourmi3->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi3->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi4 = new C3DObjElement; *(g_ObjFourmi4) = *(ObjOuvriere); g_ObjFourmi4->ChangeFrameRateRatio(10.0); g_ObjFourmi4->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi4->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi5 = new C3DObjElement; *(g_ObjFourmi5) = *(ObjOuvriere); g_ObjFourmi5->ChangeFrameRateRatio(10.0); g_ObjFourmi5->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi5->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi6 = new C3DObjElement; *(g_ObjFourmi6) = *(ObjOuvriere); g_ObjFourmi6->ChangeFrameRateRatio(10.0); g_ObjFourmi6->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi6->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi7 = new C3DObjElement; *(g_ObjFourmi7) = *(ObjOuvriere); g_ObjFourmi7->ChangeFrameRateRatio(10.0); g_ObjFourmi7->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi7->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi8 = new C3DObjElement; *(g_ObjFourmi8) = *(ObjOuvriere); g_ObjFourmi8->ChangeFrameRateRatio(10.0); g_ObjFourmi8->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi8->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi9 = new C3DObjElement; *(g_ObjFourmi9) = *(ObjOuvriere); g_ObjFourmi9->ChangeFrameRateRatio(10.0); g_ObjFourmi9->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi9->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi10 = new C3DObjElement; *(g_ObjFourmi10) = *(ObjOuvriere); g_ObjFourmi10->ChangeFrameRateRatio(10.0); g_ObjFourmi10->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi10->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi11 = new C3DObjElement; *(g_ObjFourmi11) = *(ObjOuvriere); g_ObjFourmi11->ChangeFrameRateRatio(10.0); g_ObjFourmi11->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi11->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi12 = new C3DObjElement; *(g_ObjFourmi12) = *(ObjOuvriere); g_ObjFourmi12->ChangeFrameRateRatio(10.0); g_ObjFourmi12->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi12->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi13 = new C3DObjElement; *(g_ObjFourmi13) = *(ObjOuvriere); g_ObjFourmi13->ChangeFrameRateRatio(10.0); g_ObjFourmi13->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi13->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi14 = new C3DObjElement; *(g_ObjFourmi14) = *(ObjOuvriere); g_ObjFourmi14->ChangeFrameRateRatio(10.0); g_ObjFourmi14->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi14->RandomAnimationStart(ANIMATION_WALK_UID); g_ObjFourmi15 = new C3DObjElement; *(g_ObjFourmi15) = *(ObjOuvriere); g_ObjFourmi15->ChangeFrameRateRatio(10.0); g_ObjFourmi15->SelectDefaultAnimation(ANIMATION_WALK_UID); g_ObjFourmi15->RandomAnimationStart(ANIMATION_WALK_UID); */ CVector3f PositionInitiale( 600,400,600 ); CVector3f VitesseInitiale( 5.,-180.,0 ); CVector3f Force( 0.f,-9.81f*80.f,-500.f ); CVector3f RandomPlan( 1200,0.0,1200 ); CVector3f RandomSpeed( 0, -40, 0 ); strcpy(g_sztextureparticule, g_exepath); strcat(g_sztextureparticule, "textures"PATHDELIM_S"particle.tga"); GLuint texuid; glGenTextures(1, &texuid); // Create The Texture tgaLoad(g_sztextureparticule,texuid); g_ParticleSystem.Init(1000, 5, 10, 0.8f, 1.0f, 1.0f, 0.25f, true, texuid, 10.,13., PositionInitiale, VitesseInitiale, Force, RandomPlan, RandomSpeed,&create_particle_callback, NULL); g_ParticleChrono.Reset(); return true; }