0 Members and 1 Guest are viewing this topic.
VECTOR3 sun; VECTOR3 suninv; VECTOR3 sunloc; GetGlobalPos(rsun); // global position, vaisseau par rapport au soleil rsuninv = _V(-sun.x, -sun.y, -sun.z); // inversion, position relative au vaisseau Global2Local(suninv,sunloc); //as Dora says, we did it. //**normalisation du vecteur** float length = sqrt((sunloc.x*sunloc.x)+(sunloc.y*sunloc.y)+(sunloc.z*sunloc.z)); VECTOR3 normsunloc = { sunloc.x/length, sunloc.y/length, sunloc.z/length};
VECTOR3 avel; GetAngularVel(avel);if (asin(normsunloc.y)*DEG>0) { if (avel.x < 2.5*RAD) SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0.5); else SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0); if (GetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN) > 0) SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0.0); } else if (asin(normsunloc.y)*DEG<0) { if (avel.x > -2.5*RAD) SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0.5); else SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0); if (GetThrusterGroupLevel(THGROUP_ATT_PITCHUP) > 0) SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0.0); } else if (asin(normsunloc.y)*DEG == 0) { if (GetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN) > 0) SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0.0); if (GetThrusterGroupLevel(THGROUP_ATT_PITCHUP) > 0) SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0.0); SetAngularVel(_V(0,avel.y,avel.z));}
VECTOR3 arot; GetGlobalOrientation(arot); if (arot.x > alpha) { if (avel.x < 2.5*RAD) SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0.5); else SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0); if (GetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN) > 0) SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0.0); } else { if (avel.x > -2.5*RAD) SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0.5); else SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0); if (GetThrusterGroupLevel(THGROUP_ATT_PITCHUP) > 0) SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0.0); }
Ca promet une bonne après midi de prise de tête. Désolé je suis sur FSP et deja envie de morde les murs et avec deux mois de retard... je peux pas aider plus.
no matter a écrit:J'ai en tout cas carrément pas le niveau mathématique pour ces trucs
VECTOR3 Vel={0};GetAngularVel(&vel)if(vel.x>0) SetRCSTrhuster(AXE_XMOINS,vel.x*1.6); // contre la vitesse angulaireelse SetRCSTrhuster(AXE_XPLUS,-vel.x*1.6); // contre la vitesse angulaire
Enfin bref tu vois le principe quoi, pense grosse mecanique, pas mathemathique.
Celui que j'aime le plus c'est le pilote atmo du DGIV: 14 lignes de C++
Bonne chance