0 Members and 1 Guest are viewing this topic.
void Vessel::Vessel(){ anim_gear = CreateAnimation (0.0); // création de l'animation static UINT groups[4] = {5,6,10,11}; // groupes participants static MGROUP_ROTATE nosewheel ( 0, // index du mesh groups, 4, // groupes participants et leur nombre _V(0,-1.0,8.5), // centre de rotation _V(1,0,0), // axe de rotation (float)(0.5*PI) // portée de la rotation ); AddAnimationComponent ( anim_gear // l'identificateur d'animation 0, // début de la sous-animation dans l'animation principale 1, // fin de la sous-animation &nosewheel); // classe de sous-animation}
if(gear_proc < 0.0){ gear_proc = 0.0;}
Premièrement, le group que tu souhaites animer doit être séparé dans ton fichier MSH.
[u]void[/u] SD_st_module_1::[u]SD_st_module_1[/u](){ [u]anim_gear[/u] = CreateAnimation (0.0); // création de l'animation static UINT groups[4] = {5,6,10,11}; // groupes participants static MGROUP_ROTATE nosewheel ( 0, // index du mesh groups, 4, // groupes participants et leur nombre _V(0,-1.0,8.5), // centre de rotation _V(1,0,0), // axe de rotation (float)(0.5*PI) // portée de la rotation ); AddAnimationComponent ( anim_gear // l'identificateur d'animation 0, // début de la sous-animation dans l'animation principale 1, // fin de la sous-animation &nosewheel); // classe de sous-animation}[u]if[/u](gear_proc <; 0.0){ gear_proc = 0.0;}if(gear_proc <; 1.0){ gear_proc = 1.0;}
1>------ Début de la génération : Projet : Sandersmodule1, Configuration : Release Win32 ------1> Sandersmodule1.cpp1>Sandersmodule1.cpp(343): error C2533: 'SD_st_module_1::{ctor}' : type de retour non autorisé pour les constructeurs1>Sandersmodule1.cpp(343): error C2511: 'SD_st_module_1::SD_st_module_1(void)' : impossible de trouver la fonction membre surchargée dans 'SD_st_module_1'1> Sandersmodule1.cpp(69) : voir la déclaration de 'SD_st_module_1'1>Sandersmodule1.cpp(361): error C2059: erreur de syntaxe : 'if'1>Sandersmodule1.cpp(361): error C2143: erreur de syntaxe : absence de ')' avant ';'1>Sandersmodule1.cpp(361): error C2059: erreur de syntaxe : 'constant'1>Sandersmodule1.cpp(361): error C2059: erreur de syntaxe : ')'1>Sandersmodule1.cpp(362): error C2143: erreur de syntaxe : absence de ';' avant '{'1>Sandersmodule1.cpp(362): error C2447: '{' : en-tête de fonction manquant (liste formelle à l'ancien format ?)1>Sandersmodule1.cpp(366): error C2059: erreur de syntaxe : 'if'1>Sandersmodule1.cpp(366): error C2143: erreur de syntaxe : absence de ')' avant ';'1>Sandersmodule1.cpp(366): error C2059: erreur de syntaxe : 'constant'1>Sandersmodule1.cpp(366): error C2059: erreur de syntaxe : ')'1>Sandersmodule1.cpp(367): error C2143: erreur de syntaxe : absence de ';' avant '{'1>Sandersmodule1.cpp(367): error C2447: '{' : en-tête de fonction manquant (liste formelle à l'ancien format ?)1>Sandersmodule1.cpp(372): error C2059: erreur de syntaxe : 'for'1>Sandersmodule1.cpp(372): error C2143: erreur de syntaxe : absence de ')' avant ';'1>Sandersmodule1.cpp(372): error C2143: erreur de syntaxe : absence de ';' avant '<'1>Sandersmodule1.cpp(372): error C4430: spécificateur de type manquant - int est pris en compte par défaut. Remarque : C++ ne prend pas en charge int par défaut1>Sandersmodule1.cpp(372): error C2086: 'int anim_gear' : redéfinition1> Sandersmodule1.cpp(371) : voir la déclaration de 'anim_gear'1>Sandersmodule1.cpp(372): error C2143: erreur de syntaxe : absence de ';' avant '++'1>Sandersmodule1.cpp(372): error C4430: spécificateur de type manquant - int est pris en compte par défaut. Remarque : C++ ne prend pas en charge int par défaut1>Sandersmodule1.cpp(372): error C2086: 'int anim_gear' : redéfinition1> Sandersmodule1.cpp(371) : voir la déclaration de 'anim_gear'1>Sandersmodule1.cpp(372): error C2059: erreur de syntaxe : ')'1>Sandersmodule1.cpp(382): error C2143: erreur de syntaxe : absence de ';' avant '{'1>Sandersmodule1.cpp(382): error C2447: '{' : en-tête de fonction manquant (liste formelle à l'ancien format ?)========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========
ea76620 a écrit:C'est à dire que je doit faire plusieurs MSH?
Bibi Uncle a écrit:C'est bien que tu ais réussi à progresser comment ça tout seul. Ça l'habitue à regarder des exemples des autres.Pour le corps qui bouge en même temps, peut-être le panneau solaire est dans le même groupe que le corps ?
// ==============================================================// ORBITER MODULE: HST// Part of the ORBITER SDK// Copyright (C) 2001-2007 Martin Schweiger// All rights reserved//// HST.cpp// HST basic specs and animations//// HST mesh and textures by David Sundstrom// ==============================================================#define ORBITER_MODULE#include "SDmodule1.h"#include // ==============================================================// HST class implementation// ==============================================================// --------------------------------------------------------------// Constructor// --------------------------------------------------------------SDmodule1::SDmodule1 (OBJHANDLE hObj, int fmodel): VESSEL2 (hObj, fmodel){ ant_proc = 0.0; ant_status = DOOR_CLOSED; hatch_proc = 0.0; hatch_status = DOOR_CLOSED; array_proc = 1.0; array_status = DOOR_OPEN; DefineAnimations ();}// --------------------------------------------------------------// Define animation sequences for moving parts// --------------------------------------------------------------void SDmodule1::DefineAnimations (void){ // 1. Hi-gain antenna //static UINT HiGainAnt1Grp[2] = {1,3}; //static MGROUP_ROTATE HiGainAnt1 (0, HiGainAnt1Grp, 2, _V(0.002579,1.993670,0.238158), _V(-1,0,0), (float)(PI*0.51)); //static UINT HiGainAnt2Grp[2] = {0,2}; //static MGROUP_ROTATE HiGainAnt2 (0, HiGainAnt2Grp, 2, _V(0.002740,-2.013091,0.238118), _V(1,0,0), (float)(PI*0.51)); //anim_ant = CreateAnimation (0.0196); //AddAnimationComponent (anim_ant, 0, 0.5, &HiGainAnt1); //AddAnimationComponent (anim_ant, 0, 1, &HiGainAnt2); // 2. Main telescope hatch //static UINT HatchGrp[1] = {86}; //static MGROUP_ROTATE Hatch (0, HatchGrp, 1, _V(0.089688,1.456229,7.526453), _V(-1,0,0), (float)(RAD*113)); //anim_hatch = CreateAnimation (0); //AddAnimationComponent (anim_hatch, 0, 1, &Hatch); // 3. Solar arrays - folding anim_array = CreateAnimation (2); static UINT ArrayLFoldGrp[1] = {4}; static UINT ArrayRFoldGrp[2] = {3}; static MGROUP_ROTATE ArrayLFold1 (0, ArrayLFoldGrp, 1, _V(-1.75,0, 2), _V(0, 1,0), (float)(-PI*0.5)); AddAnimationComponent (anim_array, 0.6, 1, &ArrayLFold1); static MGROUP_ROTATE ArrayRFold2 (0, ArrayRFoldGrp, 2, _V( 1.75,0, 2), _V(0, 1,0), (float)(PI*0.5)); AddAnimationComponent (anim_array, 0.6, 1, &ArrayRFold2); //static MGROUP_SCALE ArrayLFold3 (0, ArrayLFoldGrp, 4, _V(0,0.053583,1.429349), _V(1,1,4)); //AddAnimationComponent (anim_array, 0.6, 1, &ArrayLFold3); //static MGROUP_ROTATE ArrayRFold1 (0, ArrayRFoldGrp, 5, _V( 1.9, 0.053583,1.429349), _V(0, 1,0), (float)(PI*0.5)); //AddAnimationComponent (anim_array, 0, 0.4, &ArrayRFold1); //static MGROUP_ROTATE ArrayRFold2 (0, ArrayRFoldGrp, 5, _V(0,0.053583,1.429349), _V(-1,0,0), (float)(PI*0.5)); //AddAnimationComponent (anim_array, 0.4, 0.6, &ArrayRFold2); //static MGROUP_SCALE ArrayRFold3 (0, ArrayRFoldGrp, 4, _V(0,0.053583,1.429349), _V(1,1,4)); //AddAnimationComponent (anim_array, 0.6, 1, &ArrayRFold3);}//void SDmodule1::ActivateAntenna (DoorStatus action)//{// ant_status = action;//}//void SDmodule1::RevertAntenna (void)//{// ActivateAntenna ((ant_status == DOOR_CLOSED || ant_status == DOOR_CLOSING) ?// DOOR_OPENING : DOOR_CLOSING);//}//void SDmodule1::ActivateHatch (DoorStatus action)//{// hatch_status = action;//}//void SDmodule1::RevertHatch (void)//{// ActivateHatch ((hatch_status == DOOR_CLOSED || hatch_status == DOOR_CLOSING) ?// DOOR_OPENING : DOOR_CLOSING);//}void SDmodule1::ActivateArray (DoorStatus action){ array_status = action;}void SDmodule1::RevertArray (void){ ActivateArray ((array_status == DOOR_CLOSED || array_status == DOOR_CLOSING) ? DOOR_OPENING : DOOR_CLOSING);}// ==============================================================// Overloaded callback functions// ==============================================================// --------------------------------------------------------------// Set vessel class parameters// --------------------------------------------------------------void SDmodule1::clbkSetClassCaps (FILEHANDLE cfg){ THRUSTER_HANDLE th_main[2], th_hover, th_rcs[14], th_group[4]; SetSize (PB_SIZE); SetEmptyMass (PB_EMPTYMASS); SetPMI (PB_PMI); SetCrossSections (PB_CS); SetRotDrag (PB_RD); // docking port definitions SetDockParams (PB_DOCK_POS, PB_DOCK_DIR, PB_DOCK_ROT); // propellant resources PROPELLANT_HANDLE hpr = CreatePropellantResource (PB_FUELMASS); // main engine th_main[0] = CreateThruster (_V(-1.38,0,-2.15), _V(0,0,1), PB_MAXMAINTH, hpr, PB_ISP); th_main[1] = CreateThruster (_V(1.38,0,-2.15), _V(0,0,1), PB_MAXMAINTH, hpr, PB_ISP); th_group[0] = th_main[0]; th_group[1] = th_main[1]; CreateThrusterGroup (th_main, 2, THGROUP_MAIN); AddExhaust (th_main[0], 1, 0.15, _V(-1.38,0,-2.15), _V(0,0,-1)); AddExhaust (th_main[1], 1, 0.15, _V(1.38,0,-2.15), _V(0,0,-1)); PARTICLESTREAMSPEC contrail_main = { 0, 5.0, 16, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE, PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2, PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1 }; PARTICLESTREAMSPEC exhaust_main = { 0, 2.0, 20, 200, 0.05, 0.1, 8, 1.0, PARTICLESTREAMSPEC::EMISSIVE, PARTICLESTREAMSPEC::LVL_SQRT, 0, 1, PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 0.1 }; AddExhaustStream (th_main, _V(0,0.3,-10), &contrail_main); AddExhaustStream (th_main, _V(0,0.3,-5), &exhaust_main); // hover engine th_hover = CreateThruster (_V(0,-1.5,0), _V(0,1,0), PB_MAXHOVERTH, hpr, PB_ISP); CreateThrusterGroup (&th_hover, 1, THGROUP_HOVER); //AddExhaust (th_hover, 8, 1, _V(0,-1.5,1), _V(0,-1,0)); //AddExhaust (th_hover, 8, 1, _V(0,-1.5,-1), _V(0,-1,0)); //PARTICLESTREAMSPEC contrail_hover = { // 0, 5.0, 8, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE, // PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2, // PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1 //}; //PARTICLESTREAMSPEC exhaust_hover = { // 0, 2.0, 10, 200, 0.05, 0.05, 8, 1.0, PARTICLESTREAMSPEC::EMISSIVE, // PARTICLESTREAMSPEC::LVL_SQRT, 0, 1, // PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 0.1 //}; //AddExhaustStream (th_hover, _V(0,-3, 1), &contrail_hover); //AddExhaustStream (th_hover, _V(0,-3,-1), &contrail_hover); //AddExhaustStream (th_hover, _V(0,-2, 1), &exhaust_hover); //AddExhaustStream (th_hover, _V(0,-2,-1), &exhaust_hover); // RCS engines th_rcs[ 0] = CreateThruster (_V(-0.850, 1.15,-2), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 1] = CreateThruster (_V(-0.850, 1.15, 2), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 2] = CreateThruster (_V( 0.850, 1.15,-2), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 3] = CreateThruster (_V( 0.850, 1.15, 2), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 4] = CreateThruster (_V(-0.850,-1.15,-2), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 5] = CreateThruster (_V(-0.850,-1.15, 2), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 6] = CreateThruster (_V( 0.850,-1.15,-2), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 7] = CreateThruster (_V( 0.850,-1.15, 2), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 8] = CreateThruster (_V(-0.850, 1, 2.15), _V(0,0,-1), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 9] = CreateThruster (_V( 0.850,-1, 2.15), _V(0,0,-1), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[10] = CreateThruster (_V(-1, 1, 2), _V( 1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[11] = CreateThruster (_V( 1, 1, 2), _V(-1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[12] = CreateThruster (_V(-1,-1,-2), _V( 1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[13] = CreateThruster (_V( 1,-1,-2), _V(-1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[14] = CreateThruster (_V(0,0,-3.15), _V(0,0, 1), PB_MAXRCSTH, hpr, PB_ISP); AddExhaust (th_rcs[ 0], 0.4, 0.2, _V(-0.850, 1.15,-2), _V(0,-1,0)); AddExhaust (th_rcs[ 1], 0.4, 0.2, _V(-0.850, 1.15, 2), _V(0,-1,0)); AddExhaust (th_rcs[ 2], 0.4, 0.2, _V( 0.850, 1.15,-2), _V(0,-1,0)); AddExhaust (th_rcs[ 3], 0.4, 0.2, _V( 0.850, 1.15, 2), _V(0,-1,0)); AddExhaust (th_rcs[ 4], 0.4, 0.2, _V(-0.850,-1.15,-2), _V(0, 1,0)); AddExhaust (th_rcs[ 5], 0.4, 0.2, _V(-0.850,-1.15, 2), _V(0, 1,0)); AddExhaust (th_rcs[ 6], 0.4, 0.2, _V( 0.850,-1.15,-2), _V(0, 1,0)); AddExhaust (th_rcs[ 7], 0.4, 0.2, _V( 0.850,-1.15, 2), _V(0, 1,0)); AddExhaust (th_rcs[ 8], 0.4, 0.2, _V(-0.850, 1, 2.15), _V(0,0,-1)); AddExhaust (th_rcs[ 8], 0.4, 0.2, _V( 0.850,-1, 2.15), _V(0,0,-1)); AddExhaust (th_rcs[10], 0.4, 0.2, _V(-1, 1, 2), _V(-1,0,0)); AddExhaust (th_rcs[10], 0.4, 0.2, _V(-1,-1, 2), _V(-1,0,0)); AddExhaust (th_rcs[11], 0.4, 0.2, _V( 1, 1, 2), _V( 1,0,0)); AddExhaust (th_rcs[11], 0.4, 0.2, _V( 1,-1, 2), _V( 1,0,0)); AddExhaust (th_rcs[12], 0.4, 0.2, _V(-1,-1,-2), _V(-1,0,0)); AddExhaust (th_rcs[12], 0.4, 0.2, _V(-1, 1,-2), _V(-1,0,0)); AddExhaust (th_rcs[13], 0.4, 0.2, _V( 1,-1,-2), _V( 1,0,0)); AddExhaust (th_rcs[13], 0.4, 0.2, _V( 1, 1,-2), _V( 1,0,0)); AddExhaust (th_rcs[ 8], 0.4, 0.2, _V( 0.850, 1, 2.15), _V(0,0,-1)); AddExhaust (th_rcs[ 8], 0.4, 0.2, _V(-0.850,-1, 2.15), _V(0,0,-1)); AddExhaust (th_rcs[14], 0.4, 0.2, _V(-0.850, 1,-2.15), _V(0,0, 1)); AddExhaust (th_rcs[14], 0.4, 0.2, _V( 0.850, 1,-2.15), _V(0,0, 1)); AddExhaust (th_rcs[14], 0.4, 0.2, _V(-0.850,-1,-2.15), _V(0,0, 1)); AddExhaust (th_rcs[14], 0.4, 0.2, _V( 0.850,-1,-2.15), _V(0,0, 1)); th_group[0] = th_rcs[0]; th_group[1] = th_rcs[2]; th_group[2] = th_rcs[5]; th_group[3] = th_rcs[7]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHUP); th_group[0] = th_rcs[1]; th_group[1] = th_rcs[3]; th_group[2] = th_rcs[4]; th_group[3] = th_rcs[6]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHDOWN); th_group[0] = th_rcs[0]; th_group[1] = th_rcs[1]; th_group[2] = th_rcs[6]; th_group[3] = th_rcs[7]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_BANKLEFT); th_group[0] = th_rcs[2]; th_group[1] = th_rcs[3]; th_group[2] = th_rcs[4]; th_group[3] = th_rcs[5]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_BANKRIGHT); th_group[0] = th_rcs[4]; th_group[1] = th_rcs[5]; th_group[2] = th_rcs[6]; th_group[3] = th_rcs[7]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_UP); th_group[0] = th_rcs[0]; th_group[1] = th_rcs[1]; th_group[2] = th_rcs[2]; th_group[3] = th_rcs[3]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_DOWN); th_group[0] = th_rcs[11]; th_group[1] = th_rcs[12]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWLEFT); th_group[0] = th_rcs[10]; th_group[1] = th_rcs[13]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWRIGHT); th_group[0] = th_rcs[11]; th_group[1] = th_rcs[13]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_LEFT); th_group[0] = th_rcs[10]; th_group[1] = th_rcs[12]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_RIGHT); th_group[0] = th_rcs[14]; CreateThrusterGroup (th_group, 1, THGROUP_ATT_FORWARD); th_group[0] = th_rcs[8]; CreateThrusterGroup (th_group, 1, THGROUP_ATT_BACK); // camera parameters SetCameraOffset (_V(0,0,0)); // associate a mesh for the visual AddMesh ("SD_st_module_1");}// --------------------------------------------------------------// Read status from scenario file// --------------------------------------------------------------void SDmodule1::clbkLoadStateEx (FILEHANDLE scn, void *vs){ char *line; while (oapiReadScenario_nextline (scn, line)) { if (!_strnicmp (line, "ANT", 3)) { //sscanf (line+3, "%d%lf", &ant_status, &ant_proc); //} else if (!_strnicmp (line, "HATCH", 5)) { //sscanf (line+5, "%d%lf", &hatch_status, &hatch_proc); //} else if (!_strnicmp (line, "FOLD", 4)) { sscanf (line+5, "%d%lf", &array_status, &array_proc); } else { ParseScenarioLineEx (line, vs); } } //SetAnimation (anim_ant, ant_proc); //SetAnimation (anim_hatch, hatch_proc); SetAnimation (anim_array, array_proc);}// --------------------------------------------------------------// Save status to scenario file// --------------------------------------------------------------void SDmodule1::clbkSaveState (FILEHANDLE scn){ char cbuf[256]; SaveDefaultState (scn); sprintf (cbuf, "%d %0.4f", ant_status, ant_proc); oapiWriteScenario_string (scn, "ANT", cbuf); sprintf (cbuf, "%d %0.4f", hatch_status, hatch_proc); oapiWriteScenario_string (scn, "HATCH", cbuf); sprintf (cbuf, "%d %0.4f", array_status, array_proc); oapiWriteScenario_string (scn, "FOLD", cbuf);}// --------------------------------------------------------------// Frame update// --------------------------------------------------------------void SDmodule1::clbkPostStep (double simt, double simdt, double mjd){ // Animate hi-gain antenna //if (ant_status >= DOOR_CLOSING) { // double da = simdt * ANTENNA_OPERATING_SPEED; // if (ant_status == DOOR_CLOSING) { // if (ant_proc > 0.0) ant_proc = max (0.0, ant_proc-da); // else ant_status = DOOR_CLOSED; // } else { // if (ant_proc < 1.0) ant_proc = min (1.0, ant_proc+da); // else ant_status = DOOR_OPEN; // } // SetAnimation (anim_ant, ant_proc); //} // Animate main telescope hatch //if (hatch_status >= DOOR_CLOSING) { // double da = simdt * HATCH_OPERATING_SPEED; // if (hatch_status == DOOR_CLOSING) { // if (hatch_proc > 0.0) hatch_proc = max (0.0, hatch_proc-da); // else hatch_status = DOOR_CLOSED; // } else { // if (hatch_proc < 1.0) hatch_proc = min (1.0, hatch_proc+da); // else hatch_status = DOOR_OPEN; // } // SetAnimation (anim_hatch, hatch_proc); //} // Animate solar arrays if (array_status >= DOOR_CLOSING) { double da = simdt * ARRAY_OPERATING_SPEED; if (array_status == DOOR_CLOSING) { if (array_proc > 0.0) array_proc = max (0.0, array_proc-da); else array_status = DOOR_CLOSED; } else { if (array_proc < 1.0) array_proc = min (1.0, array_proc+da); else array_status = DOOR_OPEN; } SetAnimation (anim_array, array_proc); }}// --------------------------------------------------------------// Keyboard interface handler (buffered key events)// --------------------------------------------------------------int SDmodule1::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate){ if (!down) return 0; // only process keydown events if (KEYMOD_CONTROL (kstate)) { switch (key) { //case OAPI_KEY_1: // deploy/retract antenna // RevertAntenna(); // return 1; //case OAPI_KEY_2: // open/close hatch // RevertHatch(); // return 1; case OAPI_KEY_1: // open/fold solar arrays RevertArray(); return 1; } } return 0;}// --------------------------------------------------------------// Respond to generic messages// --------------------------------------------------------------int SDmodule1::clbkGeneric (int msgid, int prm, void *context){ switch (msgid) { case VMSG_LUAINTERPRETER: return Lua_InitInterpreter (context); case VMSG_LUAINSTANCE: return Lua_InitInstance (context); } return 0;}// ==============================================================// API callback interface// ==============================================================// --------------------------------------------------------------// Vessel initialisation// --------------------------------------------------------------DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel){ return new SDmodule1 (hvessel, flightmodel);}// --------------------------------------------------------------// Vessel cleanup// --------------------------------------------------------------DLLCLBK void ovcExit (VESSEL *vessel){ if (vessel) delete (SDmodule1*)vessel;}
// ==============================================================// ORBITER MODULE: Atlantis// Part of the ORBITER SDK// Copyright (C) 2001-2004 Martin Schweiger// All rights reserved//// HST.h// HST basic specs and animations//// HST mesh and textures by David Sundstrom// ==============================================================#ifndef __SDmodule1_H#define __SDmodule1_H#define STRICT#include "orbitersdk.h"// ==============================================================// Some parameters and capabilities// ==============================================================//const double ANTENNA_OPERATING_SPEED = 0.025;//const double HATCH_OPERATING_SPEED = 0.022;const double ARRAY_OPERATING_SPEED = 0.02;const double PB_SIZE = 3.15; // mean radius [m]const VECTOR3 PB_CS = {5.23,15.25,16.78}; // x,y,z cross sections [m^2]const VECTOR3 PB_PMI = {0.80,3.11,3.18};// principal moments of inertia (mass-normalised) [m^2]const VECTOR3 PB_RD = {0.025,0.025,0.02};//{0.05,0.1,0.05}; // rotation drag coefficientsconst double PB_EMPTYMASS = 1500.0; // empty vessel mass [kg]const double PB_FUELMASS = 1000.0; // max fuel mass [kg]const double PB_ISP = 1e4; // fuel-specific impulse [m/s]const double PB_MAXMAINTH = 1e4; const double PB_MAXHOVERTH = 0.0;const double PB_MAXRCSTH = 0.5e2;const VECTOR3 PB_DOCK_POS = {0,0,-3.15}; // docking port location [m]const VECTOR3 PB_DOCK_DIR = {0,0,-1}; // docking port approach directionconst VECTOR3 PB_DOCK_ROT = {0,1,0}; // docking port alignment direction// ==============================================================// HST class interface// ==============================================================class SDmodule1: public VESSEL2 {public: enum DoorStatus { DOOR_CLOSED, DOOR_OPEN, DOOR_CLOSING, DOOR_OPENING } ant_status, hatch_status, array_status; SDmodule1 (OBJHANDLE hObj, int fmodel); void DefineAnimations (void); //void ActivateAntenna (DoorStatus action); //void RevertAntenna (void); //void ActivateHatch (DoorStatus action); //void RevertHatch (void); void ActivateArray (DoorStatus action); void RevertArray (void); // Overloaded callback functions void clbkSetClassCaps (FILEHANDLE cfg); void clbkLoadStateEx (FILEHANDLE scn, void *vs); void clbkSaveState (FILEHANDLE scn); void clbkPostStep (double simt, double simdt, double mjd); int clbkConsumeBufferedKey (DWORD key, bool down, char *kstate); int clbkGeneric (int msgid, int prm, void *context);private: UINT anim_ant, anim_hatch, anim_array; double ant_proc, hatch_proc, array_proc; // script interface-related methods, implemented in HST_Lua.cpp int Lua_InitInterpreter (void *context); int Lua_InitInstance (void *context);};#endif // !__HST_H
// ==============================================================// ORBITER MODULE: HST// Part of the ORBITER SDK// Copyright (C) 2001-2007 Martin Schweiger// All rights reserved//// HST_Lua.cpp// Script extensions to HST module// ==============================================================#include "SDmodule1.h"#ifdef SCRIPTSUPPORTextern "C" {#include #include #include }// ==========================================================================// API function prototypesSDmodule1 *lua_toSDmodule1 (lua_State *L, int idx = 1);//int hstAntenna (lua_State *L);//int hstHatch (lua_State *L);int hstArray (lua_State *L);// ==========================================================================// API initialisationint SDmodule1::Lua_InitInterpreter(void *context){ lua_State *L = (lua_State*)context; // add interpreter initialisation here return 0;}int SDmodule1::Lua_InitInstance(void *context){ lua_State *L = (lua_State*)context; // check if interpreter has DG table loaded already luaL_getmetatable (L, "VESSEL.SDmodule1"); if (lua_isnil (L, -1)) { // register new functions lua_pop (L, 1); static const struct luaL_reg hstLib[] = { //{"antenna", hstAntenna}, //{"hatch", hstHatch}, {"array", hstArray}, {NULL, NULL} }; // create metatable for vessel userdata luaL_newmetatable (L, "SDmodule1.vtable"); // create a table for the overloaded methods luaL_openlib (L, "SDmodule1.method", hstLib, 0); // create metatable for accessing inherited methods from VESSEL luaL_newmetatable (L, "SDmodule1.base"); lua_pushstring (L, "__index"); luaL_getmetatable (L, "VESSEL.vtable"); lua_settable (L, -3); // set HST.base as metatable for HST.method lua_setmetatable (L, -2); // point vessel userdata to HST.method lua_pushstring (L, "__index"); lua_pushvalue (L, -2); lua_settable (L, -4); // pop HST.method from the stack lua_pop (L, 1); } lua_setmetatable (L, -2); return 0;}// ==========================================================================// Script API functionsSDmodule1 *lua_toSDmodule1 (lua_State *L, int idx){ VESSEL **pv = (VESSEL**)lua_touserdata (L, idx); SDmodule1 *hst = (SDmodule1*)*pv; return hst;}static SDmodule1::DoorStatus HSTaction[2] = { SDmodule1::DOOR_CLOSING, SDmodule1::DOOR_OPENING};//static int hstAntenna (lua_State *L)//{// SDmodule1 *hst = lua_toSDmodule1 (L, 1);// int action = lua_tointeger (L, 2);// if (hst && action >= 0 && action < 2)// hst->ActivateAntenna (HSTaction[action]);// return 0;//}//static int hstHatch (lua_State *L)//{// SDmodule1 *hst = lua_toSDmodule1 (L, 1);// int action = lua_tointeger (L, 2);// if (hst && action >= 0 && action < 2)// hst->ActivateHatch (HSTaction[action]);// return 0;//}static int hstArray (lua_State *L){ SDmodule1 *hst = lua_toSDmodule1 (L, 1); int action = lua_tointeger (L, 2); if (hst && action >= 0 && action < 2) hst->ActivateArray (HSTaction[action]); return 0;}// ==========================================================================#else // skip script support: dummy stubsint SDmodule1::Lua_InitInterpreter(void *context){ return 0;}int SDmodule1::LuaInitInstance (void *context){ return 0;}#endif // SCRIPTSUPPORT
j'utilise perso un utilitaire 3dmax qui m'exporte aussi un fichier C++ de définition de groupe.
DanSteph a écrit:C'est vachement bien de t'être dépatouillé tout seul, 90% des gens abandonnent déjà avant ce stade
Bibi Uncle a écrit:Ton erreur est là :static UINT ArrayLFoldGrp[1] = {4};static UINT ArrayRFoldGrp[2] = {3};ArrayRFoldGrp[2] signifie que tu crées un tableau de 2 UINT, mais tu n'initialises seulement un UINT. L'autre est automatique mis à zéro car ta DLL est en debug. Le groupe zéro doit être le groupe du corps du module.
ea76620 a écrit:Bon c'est pas tout mais maintenant je vais m'occuper de la gestion des UMMU (allez dans combien de temps le prochain bug? )