// ==============================================================
// ORBITER MODULE: MARKIXHAWK1
// Part of the ORBITER SDK
// Copyright (C) 2002-2004 Martin Schweiger
// All rights reserved
//
// MARKIXHAWK1.cpp
// Control module for MARKIXHAWK1 vessel class
//
// ==============================================================
//#define STRICT
//#define ORBITER_MODULE
#include "orbitersdk.h"
#include "ParaRover.h"
VISHANDLE MainExternalMeshVisual = 0;
Para_rover::Para_rover(OBJHANDLE hObj, int fmodel)
: VESSEL3(hObj, fmodel)
{
Height_From_Ground = -.111;
DefineAnimations();
}
void Para_rover::clbkSetClassCaps(FILEHANDLE cfg) {
// physical specs
SetSize(1);
SetEmptyMass(MASS);
SetCW(0.9, 0.9, 2, 1.4);
SetWingAspect(0.1);
SetWingEffectiveness(0.1);
SetCrossSections(_V(12.16, 15.99, 9.39));
SetRotDrag(_V(0.1, 0.1, 0.1));
if (GetFlightModel() >= 1) {
SetPitchMomentScale(1e-4);
SetBankMomentScale(1e-4);
}
SetPMI(_V(3.75, 3.48, 2.23));
SetTrimScale(0.05);
SetCameraOffset(_V(0, .7, 3.121));
SetSurfaceFrictionCoeff(0.01, 0.75);
TOUCHDOWNVTX td[4];
double ro = Passo;
double x_target = -0.5;
double stiffness = (-1)*(MASS*9.80655) / (3 * x_target);
double damping = 0.9*(2 * sqrt(MASS*stiffness));
for (int i = 0; i<4; i++)
{
td[i].damping = damping;
td[i].mu = 3;
td[i].mu_lng = 3;
td[i].stiffness = stiffness;
}
td[0].pos.x = cos(30 * RAD)*ro;
td[0].pos.y = -Height_From_Ground;
td[0].pos.z = -sin(30 * RAD)*ro;
td[1].pos.x = 0;
td[1].pos.y = -Height_From_Ground;
td[1].pos.z = 1 * ro;
td[2].pos.x = -cos(30 * RAD)*ro;
td[2].pos.y = -Height_From_Ground;
td[2].pos.z = -sin(30 * RAD)*ro;
td[3].pos.x = 0;
td[3].pos.y = 15 * ro;
td[3].pos.z = 0;
SetTouchdownPoints(td, 4);
//SetTouchdownPoints(_V(0, -8.7, 10), _V(-1.6, -8.7, -10), _V(1.6, -8.7, -10));;
LR2 = CreateAttachment(true, _V(0 ,- .1207033, - .4531974), _V(0, 1, 0), _V(0, 0, 1), "LANDER", false);
SetMeshVisibilityMode(AddMesh(oapiLoadMeshGlobal("Par_rover")), MESHVIS_ALWAYS); //Main ship mesh
}
void Para_rover::clbkPreStep(double simt, double simdt, double mjd) {
}
void Para_rover::clbkPostStep(double simt, double simdt, double mjd) {
}
void Para_rover::DefineAnimations(void) {
}
// --------------------------------------------------------------
// Keyboard interface handPara_rover (buffered key events)
// --------------------------------------------------------------
int Para_rover::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate) {
// only process keydown events
if (!down) return 0;
return 0;
}
void Para_rover::clbkVisualCreated(VISHANDLE vis, int refcount) {
MainExternalMeshVisual = GetMesh(vis, 0);
// We warn the user, in the case UMmu isn't installed it's a good idea to send a "oapiDebugString"
// Orbiter message, otherwise your addon will not be fully operational and user may not notice.
// (nobody read doc, you may be the only one, if you read this send me a postcard ;)
}
// ==============================================================
// Visual destroyed
// ==============================================================
void Para_rover::clbkVisualDestroyed(VISHANDLE vis, int refcount) {
MainExternalMeshVisual = 0;
}
// ========================================================================
// clbkLoadState function of Orbiter - Save scenario when user exit Orbiter
// ========================================================================
void Para_rover::clbkSaveState(FILEHANDLE scn)
{
char cbuf[256];
// ORBITER, default vessel parameters
// ORBITER, default vessel parameters
SaveDefaultState(scn);
}
// ========================================================================
// clbkLoadStateEx function of Orbiter - Load Orbiter scenario
// ========================================================================
void Para_rover::clbkLoadStateEx(FILEHANDLE scn, void *status)
{
char *line;
while (oapiReadScenario_nextline(scn, line))
{
{
ParseScenarioLineEx(line, status);
// unrecognised option - pass to Orbiter's generic parser
}
}
}
void Para_rover::clbkFocusChanged(bool getfocus, OBJHANDLE hNewVessel, OBJHANDLE hOldVessel) {
// erase message if we focus to another vessel
if (!getfocus) strcpy(oapiDebugString(), "");
}