Hey,
i'm new to the World of Orbiter and at the moment, i'm trying to code my first own vessel. It's a Vessel3 Class based ship.
This is where and how i set up my Thrusters.
I did it in clbkSetClassCaps
Now, i got a calculation in clbkPreStep based on the Simulation time.
Its a calculation for fuel useage / fuel flow.
I took a fuel tank to simulate my life support system (called LSS). This is why i need the calculation based on the simulation time.
And if the LSS is down, the Pilot is "dead" so the control of the vessel is lost. I tried to implement this setting the thrusterlevel to 0.
So all in all, the code disables the Main engine, but not all the other thrusters.
Whether SetAttitudeMode(RCS_NONE);, nor the for loop will work correctly.
I hope someone of you can help me with this. Already got many, many good workarounds and tips around here.
Edit/ i tried it with eg.: SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN) etc. also, but this doesen't work either. Only THGROUP_Main can be shut down.
i'm new to the World of Orbiter and at the moment, i'm trying to code my first own vessel. It's a Vessel3 Class based ship.
This is where and how i set up my Thrusters.
I did it in clbkSetClassCaps
Code:
void MyVessel::clbkSetClassCaps(FILEHANDLE cfg)
{
...Stuff like Empty Mass, Mesh, Propellants....etc.
// Thrusters
thRCS[0] = CreateThruster( _V( -3.15, 0 , -0.67 ), _V( 0, 0, 1 ), 50000.0, hPropellant, 100000.0);
thRCS[1] = CreateThruster( _V( 3.15, 0 , -0.67 ), _V( 0, 0, 1 ), 50000.0, hPropellant, 100000.0);
thRCS[2] = CreateThruster( _V( -3.15, 0 , 0.67 ), _V( 0, 0, -1 ), 50000.0, hPropellant, 100000.0);
thRCS[3] = CreateThruster( _V( 3.15, 0 , 0.67 ), _V( 0, 0, -1 ), 50000.0, hPropellant, 100000.0);
thRCS[4] = CreateThruster( _V( -4.25, 0 , 0 ), _V( 1, 0, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[5] = CreateThruster( _V( 4.25, 0 , 0 ), _V( -1, 0, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[6] = CreateThruster( _V( -3.15, -0.06, -0.67 ), _V( 0, 1, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[7] = CreateThruster( _V( 3.15, -0.06, -0.67 ), _V( 0, 1, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[8] = CreateThruster( _V( -3.15, -0.06, 0.67 ), _V( 0, 1, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[9] = CreateThruster( _V( 3.15, -0.06, 0.67 ), _V( 0, 1, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[10] = CreateThruster( _V( -3.15, 0.06, -0.67 ), _V( 0, -1, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[11] = CreateThruster( _V( 3.15, 0.06, -0.67 ), _V( 0, -1, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[12] = CreateThruster( _V( -3.15, -0.06, 0.67 ), _V( 0, -1, 0 ), 50000.0, hPropellant, 100000.0);
thRCS[13] = CreateThruster( _V( 3.15, -0.06, 0.67 ), _V( 0, -1, 0 ), 50000.0, hPropellant, 100000.0);
// Main Engine
thMain[0] = CreateThruster( _V( -1.1, 0 , -1.3 ), _V( 0, 0, 1 ), 100000.0, hPropellant, 100000.0);
thMain[1] = CreateThruster( _V( 1.1, 0 , -1.3 ), _V( 0, 0, 1 ), 100000.0, hPropellant, 100000.0);
THRUSTER_HANDLE thGrp[4];
thGrp[0] = thRCS[8];
thGrp[1] = thRCS[9];
thGrp[2] = thRCS[10];
thGrp[3] = thRCS[11];
CreateThrusterGroup(thGrp, 4, THGROUP_ATT_PITCHUP);
thGrp[0] = thRCS[6];
thGrp[1] = thRCS[7];
thGrp[2] = thRCS[12];
thGrp[3] = thRCS[13];
CreateThrusterGroup(thGrp, 4, THGROUP_ATT_PITCHDOWN);
thGrp[0] = thRCS[1];
thGrp[1] = thRCS[2];
CreateThrusterGroup(thGrp, 2, THGROUP_ATT_YAWLEFT);
thGrp[0] = thRCS[0];
thGrp[1] = thRCS[3];
CreateThrusterGroup(thGrp, 2, THGROUP_ATT_YAWRIGHT);
thGrp[0] = thRCS[7];
thGrp[1] = thRCS[9];
thGrp[2] = thRCS[10];
thGrp[3] = thRCS[12];
CreateThrusterGroup(thGrp, 4, THGROUP_ATT_BANKLEFT);
thGrp[0] = thRCS[6];
thGrp[1] = thRCS[8];
thGrp[2] = thRCS[11];
thGrp[3] = thRCS[13];
CreateThrusterGroup(thGrp, 4, THGROUP_ATT_BANKRIGHT);
thGrp[0] = thRCS[4];
CreateThrusterGroup(thGrp, 1, THGROUP_ATT_RIGHT);
thGrp[0] = thRCS[5];
CreateThrusterGroup(thGrp, 1, THGROUP_ATT_LEFT);
thGrp[0] = thRCS[6];
thGrp[1] = thRCS[7];
thGrp[2] = thRCS[8];
thGrp[3] = thRCS[9];
CreateThrusterGroup(thGrp, 4, THGROUP_ATT_UP);
thGrp[0] = thRCS[10];
thGrp[1] = thRCS[11];
thGrp[2] = thRCS[12];
thGrp[3] = thRCS[13];
CreateThrusterGroup(thGrp, 4, THGROUP_ATT_DOWN);
thGrp[0] = thRCS[0];
thGrp[1] = thRCS[1];
CreateThrusterGroup(thGrp, 2, THGROUP_ATT_FORWARD);
thGrp[0] = thRCS[2];
thGrp[1] = thRCS[3];
CreateThrusterGroup(thGrp, 2, THGROUP_ATT_BACK);
// Kombination der Twin Ion Engines zur Haupttriebwerk
thGrp[0] = thMain[0];
thGrp[1] = thMain[1];
CreateThrusterGroup(thGrp, 2, THGROUP_MAIN);
for(int i = 0; i<14; i++)
AddExhaust(thRCS[i], 0.4 , 0.02);
for(int i = 0; i<2; i++)
AddExhaust(thMain[i], 1.0 , 0.06);
Now, i got a calculation in clbkPreStep based on the Simulation time.
Its a calculation for fuel useage / fuel flow.
I took a fuel tank to simulate my life support system (called LSS). This is why i need the calculation based on the simulation time.
And if the LSS is down, the Pilot is "dead" so the control of the vessel is lost. I tried to implement this setting the thrusterlevel to 0.
Code:
void MyVessel::clbkPreStep(double simt, double simdt, double mjd)
{
if(GetPropellantMass(LSS)>0)
{
....Calculate fuel flow and update mass in fueltank
}
else
{
SetAttitudeMode(RCS_NONE); [COLOR="Blue"]has no effect on RCS Thrusters[/COLOR]
SetThrusterGroupLevel(THGROUP_MAIN, 0);
[COLOR="Blue"]next try, also has no effect on RCS Thrusters[/COLOR]
for (int i=1; i<14; i++)
{
SetThrusterLevel(thRCS[i],0);
}
sprintf(oapiDebugString(),"Life Support System down! Lost control of Spaceship!");
}
}
So all in all, the code disables the Main engine, but not all the other thrusters.
Whether SetAttitudeMode(RCS_NONE);, nor the for loop will work correctly.
I hope someone of you can help me with this. Already got many, many good workarounds and tips around here.
Edit/ i tried it with eg.: SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN) etc. also, but this doesen't work either. Only THGROUP_Main can be shut down.
Last edited: