void ORION2NEW::blowSM() {
int j = 0;
SetMeshVisibilityMode(smMeshUINT, MESHVIS_NEVER);
if (oapiGetTimeAcceleration() > 10) // Slow down
oapiSetTimeAcceleration(10);
if (mode > 9) j++;
SetConfig2_Reentry();
VESSELSTATUS vs;
char name[256] = { "" };
THRUSTER_HANDLE th_att_lin[16];
OBJHANDLE h;
VESSEL *v;
GetStatus(vs);
vs.flag[0] = 3;
// VECTOR3 ofs = {0,0,-3};
//VECTOR3 ofs = { 0, 0, -2.06 };
Local2Rel(ofs, vs.rpos);
VECTOR3 vel = _V(0, 0, -0.02);
VECTOR3 rofs, rvel = { vs.rvel.x, vs.rvel.y, vs.rvel.z };
Local2Rel(ofs, vs.rpos);
GlobalRot(vel, rofs);
vs.rvel.x = rvel.x + rofs.x;
vs.rvel.y = rvel.y + rofs.y;
vs.rvel.z = rvel.z + rofs.z;
strcpy(name, GetName()); strcat(name, "-SM");
h = oapiCreateVessel(name, "Orion-MPCV\\orion606-SM", vs);
v = oapiGetVesselInterface(h);
v->SetAnimation(anim_JOINT2, JOINT2_proc);
v->SetAnimation(anim_JOINT1, JOINT1_proc);
v->SetAnimation(anim_JOINT7, ARM3_proc);
v->SetAnimation(anim_HGA, HGA_proc);
v->SetEmptyMass(SM_DRYMASS);
ph_RM = v->CreatePropellantResource(10.0, 10.0, 1.0);
// CreateThruster (_V( 0.06, 2.10, -1.49), _V(0,-0.7,-0.7), RCS_THRUST, ph_RM, RCS_ISP);
th_att_lin[8] = v->CreateThruster(_V(0.06, 2.10, -1.49), _V(0, -0.7, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
th_att_lin[9] = v->CreateThruster(_V(-0.06, 2.10, -1.49), _V(0, -0.7, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
th_att_lin[10] = v->CreateThruster(_V(0.06, -2.10, -1.49), _V(0, 0.7, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
th_att_lin[11] = v->CreateThruster(_V(-0.06, -2.10, -1.49), _V(0, 0.7, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
th_att_lin[12] = v->CreateThruster(_V(2.10, 0.06, -1.49), _V(-0.7, 0, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
th_att_lin[13] = v->CreateThruster(_V(2.10, -0.06, -1.49), _V(-0.7, 0, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
th_att_lin[14] = v->CreateThruster(_V(-2.10, 0.06, -1.49), _V(0.7, 0, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
th_att_lin[15] = v->CreateThruster(_V(-2.10, -0.06, -1.49), _V(0.7, 0, -0.7), RCS_THRUST / 3, ph_RM, RCS_ISP);
for (int i = 8; i<16; i++) {
v->AddExhaust(th_att_lin[i], R_SIZE, tex_rcs);
v->AddExhaustStream(th_att_lin[i], &rcs_stream);
v->SetThrusterLevel(th_att_lin[i], 1.0);
}
v->SetSize(6);
v->SetCrossSections(_V(24, 28, 19));
v->SetCW(0.5, 0.5, 1, 1);
if (j) return;
// Hack to display the solar panel around the separated RM
GetStatus(vs);
vs.flag[0] = 3;
ofs = _V(0, 0, -1.87);
Local2Rel(ofs, vs.rpos);
vel = _V(0, 0, -0.02);
rofs, rvel = _V(vs.rvel.x, vs.rvel.y, vs.rvel.z);
Local2Rel(ofs, vs.rpos);
GlobalRot(vel, rofs);
vs.rvel.x = rvel.x + rofs.x;
vs.rvel.y = rvel.y + rofs.y;
vs.rvel.z = rvel.z + rofs.z;
//strcpy(name, "S");
//h = oapiCreateVessel(name, "Orion-MPCV\\Orion-SMS", vs); // config file of created solar panel
//v = oapiGetVesselInterface(h);
v->SetEmptyMass(SM_DRYMASS);
ph_RM = v->CreatePropellantResource(7.06, 7.06, 1.0);
th_att_lin[0] = v->CreateThruster(_V(0, 0, 0), _V(0, 0, -1), 0.703 * 8 * RCS_THRUST / 3, ph_RM, RCS_ISP);
v->SetThrusterLevel(th_att_lin[0], 1.0);
v->SetSize(6);
v->SetCrossSections(_V(24, 28, 19));
v->SetCW(0.5, 0.5, 1, 1);
v->SetEnableFocus(false);
}