Example #1
0
void MIG15_Setup (AirStrucPtr const ControlledAC, ULong Version)
{
	ClassPtr data = ControlledAC->classtype;
	PMODEL pModel = ControlledAC->fly.pModel;
	Model& Model = *ControlledAC->fly.pModel;
	AircraftAnimData* adptr = (AircraftAnimData* )ControlledAC->Anim;

	switch (Version)
	{
		case 1:
			Model.Type = AT_MIG15;
			break;
		case 2:
			Model.Type = AT_MIG15BIS;
			break;
	}

	SWord CoG = -388;//484;	//Max 388 (Wing 26%MAC)
	PMAINPLANE pMainPlane = new MAINPLANE (pModel, 71000, 240, 390, 32000, 190, 220);
	pMainPlane->SetPosition(125, 0, -330-CoG, 370, -15, -510-CoG);
	pMainPlane->SetOrientation (0.75, 0, -3, 0.75, 0, -3);		//IGNORE SWEEP
	pMainPlane->SetMaskAngle(0, 0, 0, 0);//-0.534, -0.666, 50, 50);//
	pMainPlane->SetDragPolar (0.0175, 0.0825);

	pMainPlane->SetCurves ("MIG15", "Cl", "Cd", "CompCd0", "CompK", "Cm");
	pMainPlane->dCMdq = 0;//-0.01;//
	pMainPlane->dCMdp = 0;
	pMainPlane->dCMdr = 0;

	pMainPlane->buffetAoa0 = Degs2Rads(13);
	pMainPlane->buffetAoa1 = Degs2Rads(17.5);
	pMainPlane->buffetM0  = 0.8;
	pMainPlane->buffetM1  = 1.0;
	pMainPlane->ACMmaxaoa = Degs2Rads(15);


	PSURFACE pTailPlane1 = new SURFACE (pModel, ST_PLANE, SD_TAILPLANE, 15000);//, 110);
	pTailPlane1->SetPosition (55, 175, -875-CoG);
	pTailPlane1->SetOrientation (0, 0, 0);
	pTailPlane1->SetMaskAngle(0, 0);//-0.675, 50);//
	pTailPlane1->SetCurves ("MIG15", "TailCl", "COMM", "TailCd");//, "", "", "COMM", "CompK");

	PSURFACE pTailPlane2 = new SURFACE (pModel, ST_PLANE, SD_TAILPLANE, 15000);//, 110);
	pTailPlane2->SetPosition (-55, 175, -875-CoG);
	pTailPlane2->SetOrientation (0, 0, 0);
	pTailPlane2->SetMaskAngle(0, 0);//0.675, 50);//
	pTailPlane2->SetCurves ("MIG15", "TailCl", "COMM", "TailCd");//, "", "", "COMM", "CompK");

	PSURFACE pFin = new SURFACE (pModel, ST_PLANE, SD_FIN, 40000);//40000);//, 260);
	pFin->SetPosition (0, 100, -730-CoG);
	pFin->SetOrientation (0, 0, -90);
	pFin->SetMaskAngle(0, 0);//-0.207, 50);//-0.1, 100);//
	pFin->SetCurves ("MIG15", "FinCl", "COMM", "TailCd");//, "", "", "COMM", "CompK");


	PCYLINDER pCylinder1 = new CYLINDER (pModel, 275, 135, 145);
	pCylinder1->SetPosition(0, 0, -135-CoG);
	pCylinder1->SetOrientation (0, 0, 0);

	PCYLINDER pCylinder2 = new CYLINDER (pModel, 275, 145, 145);
	pCylinder2->SetPosition(0, 0, -410-CoG);
	pCylinder2->SetOrientation (0, 0, 0);

	PCYLINDER pCylinder3 = new CYLINDER (pModel, 275, 115, 115);
	pCylinder3->SetPosition(0, 0, -685-CoG);
	pCylinder3->SetOrientation (0, 0, 0);


	new NEWCTRL (pMainPlane,  &Model.Aileron,  17.5, Degs2Rads(15), Degs2Rads(15) );
	new NEWCTRL (pTailPlane1, &Model.Elevator, 30, Degs2Rads(16), Degs2Rads(32) );
	new NEWCTRL (pTailPlane2, &Model.Elevator, 30, Degs2Rads(16), Degs2Rads(32) );
	new NEWCTRL (pFin,        &Model.Rudder,   25, Degs2Rads(20), Degs2Rads(20) );

	Model.MControlLoss0		= 0.3;
	Model.MControlLoss1		= 0.9;

	new AERODEVICE (ControlledAC,pModel, AeroDevice::DT_FLAPS, 0.5, 0.15, -0.25, DEGS2RADS(2.5), 256, FLAPSUPDOWN, &adptr->acflaps);//RJS 14May98
	new AERODEVICE (ControlledAC,pModel, AeroDevice::DT_SPEEDBRAKES, 0, 0.05, 0, 0, 256, SPEEDBRAKE, &adptr->acbreak);//RJS 14May98
	new AERODEVICE (ControlledAC,pModel, AeroDevice::DT_GEAR,  -0.1,   0.04, -0.01, 0, /*35*/128, GEARUPDOWN, NULL, 0);


	PENGINE pEngine;
	switch (Version)
	{
		case 1:
			pEngine = new ENGINE (pModel, ET_JET, 22269, 11500, 0.00000005,
								  _CurveRsc.FindCurve ("MIG15", "JetMachFact"),
								  _CurveRsc.FindCurve ("F86E", "JetThrustRpm"),
								  _CurveRsc.FindCurve ("F86E", "JetWindMillDrag"),
								  _CurveRsc.FindCurve ("F86E", "JetWindMillRpm"));
			break;
		case 2:
			pEngine = new ENGINE (pModel, ET_JET, 26476, 11500, 0.00000005,
								  _CurveRsc.FindCurve ("MIG15", "JetMachFact"),
								  _CurveRsc.FindCurve ("F86E", "JetThrustRpm"),
								  _CurveRsc.FindCurve ("F86E", "JetWindMillDrag"),
								  _CurveRsc.FindCurve ("F86E", "JetWindMillRpm"));
			break;
	}

	PTHRUSTPOINT pThrust = new THRUSTPOINT (pModel, TT_JET, 0, 0, -1110-CoG, 0,0);

	pThrust->SetEngine (pEngine);
	pEngine->SetThrustPoint (pThrust);

	Coords3D w,c1,c2;
	FCRD CG;	//Relative to the centre of the shape

	CG.x = Model.ShapeCoG.x;
	CG.y = Model.ShapeCoG.y;
	CG.z = Model.ShapeCoG.z;

	SHAPE.GetContactPoint(ControlledAC, CT_EYE, w, c1, c2);
	Model.PilotEyePos.x = c1.X - CG.x;
	Model.PilotEyePos.y = c1.Y - CG.y;
	Model.PilotEyePos.z = c1.Z - CG.z;

	SHAPE.GetContactPoint(ControlledAC, CT_WHLFRONT, w, c1, c2);
	PGEAR pNose = new GEAR (pModel, NOSE);
	pNose->SetDimensions (c1.X - CG.x, c1.Y - CG.y, c1.Z - CG.z, c2.X - CG.x, c2.Y - CG.y, c2.Z - CG.z);
	pNose->SetSuspension (15000, 100000);
	pNose->SetTyres (0.02, 1, 0);

	SHAPE.GetContactPoint(ControlledAC, CT_WHLLEFT, w, c1, c2);
	PGEAR pMainPort = new GEAR (pModel, PORT);
	pMainPort->SetDimensions (c1.X - CG.x, c1.Y - CG.y, c1.Z - CG.z, c2.X - CG.x, c2.Y - CG.y, c2.Z - CG.z);
	pMainPort->SetSuspension (55000, 500000);
	pMainPort->SetTyres (0.02, 1, 12500);

	SHAPE.GetContactPoint(ControlledAC, CT_WHLRIGHT, w, c1, c2);
	PGEAR pMainStbd = new GEAR (pModel, STBD);
	pMainStbd->SetDimensions (c1.X - CG.x, c1.Y - CG.y, c1.Z - CG.z, c2.X - CG.x, c2.Y - CG.y, c2.Z - CG.z);
	pMainStbd->SetSuspension (55000, 500000);
	pMainStbd->SetTyres (0.02, 1, 12500);

	SHAPE.GetContactPoint(ControlledAC, CT_BACK, w, c1, c2);	//FAKE GEAR TO STOP TAIL HITTING GROUND
	PGEAR pTail = new GEAR (pModel, TAIL);
	pTail->SetDimensions (c1.X - CG.x, c1.Y - CG.y - 10, c1.Z - CG.z, c2.X - CG.x, c2.Y - CG.y, c2.Z - CG.z);
	pTail->SetSuspension (100000, 100000);
	pTail->SetTyres (0.1, 1, 0);

	pModel->SetMassInertias (ControlledAC, 7862, 10539, 4675);


	Model.MaxG = 9;
	Model.MinG = -5;

	Model.ControlForce = 100;			// Relative amount of force feedback
	Model.BuffetForce  = 100;

	Model.PowerBoost = (FP)1.25;
	Model.ContrailDuration = 1.0;

	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.aileron, &adptr->acaileronr);//RJS 14May98
	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.aileron, &adptr->acaileronl, 32767,-32768);//RJS 14May98
	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.elevator, &adptr->acelevator, 32767,-32768);//RJS 14May98
	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.rudder, &adptr->acrudder);//RJS 14May98
	new MODELANIM (ControlledAC,MA_SUSPENSION, pNose, &adptr->aclegsuspf, 0, 255);
	new MODELANIM (ControlledAC,MA_SUSPENSION, pMainPort, &adptr->aclegsuspl, 0, 255);
	new MODELANIM (ControlledAC,MA_SUSPENSION, pMainStbd, &adptr->aclegsuspr, 0, 255);


	Mig15_SetupAI(ControlledAC, Version);
}
Example #2
0
void YAK9_Setup (AirStrucPtr const ControlledAC, ULong Version)
{

	ClassPtr data = ControlledAC->classtype;
	PMODEL pModel = ControlledAC->fly.pModel;
	Model& Model = *ControlledAC->fly.pModel;
	AircraftAnimData* adptr = (AircraftAnimData* )ControlledAC->Anim;

	Model.Type = AT_YAK9;

	FP CoG = -352;//26%MAC

	PTHRUSTPOINT pThrust = new THRUSTPOINT (pModel, TT_PROP, 0, 0, -45-CoG, 0, 0);

	PMAINPLANE pMainPlane = new MAINPLANE (pModel, 45750, 230, 345, 40000, 165, 215);
	pMainPlane->SetPosition(140, -45, -350-CoG, 430, -20, -350-CoG);
	pMainPlane->SetOrientation (1, 0, 5, 1, 0, 5);
	pMainPlane->SetMaskAngle(0, 0, 0, 0);//-0.865, -1.089);//
	pMainPlane->SetDragPolar (0.0163, 0.0724);
	pMainPlane->SetCurves ("F80C", "Cl", "Cd", "CompCd0", "CompK", "Cm");
//DeadCode AMM 29Jun99 	pMainPlane->StallAoa = Degs2Rads(0);//22.5);
//DeadCode AMM 29Jun99 	pMainPlane->UnStallAoa = Degs2Rads(12.5);
	pMainPlane->dCMdq = 0;
	pMainPlane->dCMdp = 0;
	pMainPlane->dCMdr = -1;


	pMainPlane->SetSlipstream(pThrust, 50);
	

	pMainPlane->buffetAoa0 = Degs2Rads(15);	
	pMainPlane->buffetAoa1 = Degs2Rads(20);
	pMainPlane->buffetM0  = 0.95;	
	pMainPlane->buffetM1  = 1.05;	
	pMainPlane->ACMmaxaoa = Degs2Rads(17.5);


	PSURFACE pTailPlane1 = new SURFACE (pModel, ST_PLANE, SD_TAILPLANE, 19000);//, 95);
	pTailPlane1->SetPosition (75, 30, -825-CoG);
	pTailPlane1->SetOrientation (0, 0, 0);
	pTailPlane1->SetMaskAngle(0, 0);
	pTailPlane1->SetCurves ("P51D", "TailCl", "COMM", "TailCd");//, "", "", "COMM", "CompK");
	pTailPlane1->SetSlipstream(pThrust, 50);//84);
	
	PSURFACE pTailPlane2 = new SURFACE (pModel, ST_PLANE, SD_TAILPLANE, 19000);//, 95);
	pTailPlane2->SetPosition (-75, 30, -825-CoG);
	pTailPlane2->SetOrientation (0, 0, 0);
	pTailPlane2->SetMaskAngle(0, 0);
	pTailPlane2->SetCurves ("P51D", "TailCl", "COMM", "TailCd");//, "", "", "COMM", "CompK");
	pTailPlane2->SetSlipstream(pThrust, 50);//84);
	
	PSURFACE pFin = new SURFACE (pModel, ST_PLANE, SD_FIN, 20800);//, 135);
	pFin->SetPosition (0, 80, -875-CoG);
	pFin->SetOrientation (0, 0, -90);
	pFin->SetMaskAngle(0, 0);//-0.153);
	pFin->SetCurves ("P51D", "FinCl", "COMM", "TailCd");//, "", "", "COMM", "CompK");
	pFin->SetSlipstream(pThrust, 50);//90);		

	
	PCYLINDER pCylinder1 = new CYLINDER (pModel, 280, 85, 115);
	pCylinder1->SetPosition(0, 0, -150-CoG);
	pCylinder1->SetOrientation(0, 0, 0);

	PCYLINDER pCylinder2 = new CYLINDER (pModel, 305, 90, 165);
	pCylinder2->SetPosition(0, 0, -450-CoG);
	pCylinder2->SetOrientation(0, 0, 0);

	PCYLINDER pCylinder3 = new CYLINDER (pModel, 410, 50, 90);
	pCylinder3->SetPosition(0, 0, -775-CoG);
	pCylinder3->SetOrientation(0, 0, 0);

	
	new NEWCTRL (pMainPlane,  &Model.Aileron,  17.5, Degs2Rads(10), Degs2Rads(10) );
	new NEWCTRL (pTailPlane1, &Model.Elevator, 30, Degs2Rads(20), Degs2Rads(30) );
	new NEWCTRL (pTailPlane2, &Model.Elevator, 30, Degs2Rads(20), Degs2Rads(30) );
	new NEWCTRL (pFin,        &Model.Rudder,   40, Degs2Rads(30), Degs2Rads(30) );

	new AERODEVICE (ControlledAC,pModel, AeroDevice::DT_FLAPS, 0.75,  0.15, -0.25, DEGS2RADS(5), 256, FLAPSUPDOWN, &adptr->acflaps);//RJS 14May98
	new AERODEVICE (ControlledAC,pModel, AeroDevice::DT_GEAR,  0,    0.05, -0.01, 0, 4096/*128*/, GEARUPDOWN, NULL, 0);


	PENGINE pEngine = new ENGINE (pModel, ET_PISTON);
 	pEngine->RotateDirection = 1;			//Clockwise from behind
 	pEngine->IdleSpeed = RPM2RADSPERCSEC (500);
	pEngine->MoI = 64e6;
	pEngine->PropInertia.x = 10000000;
	pEngine->PropInertia.y = 10000000;
	pEngine->PropInertia.z = 20000000;
	pEngine->BladeRadius = 170;
	pEngine->BladeArea = 17000;	// 4x AR=5	//7771;
	pEngine->GearRatio = 0.479;
	pEngine->pPower100 = _CurveRsc.FindCurve ("YAK9", "Power100");
	pEngine->pPower0 = _CurveRsc.FindCurve ("F51D", "Power0");
	pEngine->pPowerAlt = _CurveRsc.FindCurve ("F51D", "PowerAlt");
	pEngine->pPowerAltSuper = _CurveRsc.FindCurve ("F51D", "PowerAltSuper");	//CSB
//DeadCode CSB 28/04/99		pEngine->pPropEff = _CurveRsc.FindCurve ("F51D", "PropEff");
//DeadCode CSB 28/04/99		pEngine->pPropTq = _CurveRsc.FindCurve ("F51D", "PropTq");
//DeadCode AMM 29Jun99 	pEngine->EngineCount = 1;
	pEngine->HighBlowerAlt = 457205;	//High Gear Supercharger cuts in at 15000ft //CSB
	pEngine->LowBlowerAlt  = 411485;	//High Gear Supercharger cuts out at 13500ft //CSB
	pEngine->BlowerHigh	   = FALSE;
	pEngine->p0 = 1590;
	pEngine->T100 = 1185000;
	
	pThrust->SetEngine (pEngine);
	pEngine->SetThrustPoint (pThrust);

	
	Coords3D w,c1,c2;
	FCRD CG;	//Relative to the centre of the shape

	CG.x = Model.ShapeCoG.x;
	CG.y = Model.ShapeCoG.y;
	CG.z = Model.ShapeCoG.z;

	SHAPE.GetContactPoint(ControlledAC, CT_EYE, w, c1, c2);
	Model.PilotEyePos.x = c1.X - CG.x;
	Model.PilotEyePos.y = c1.Y - CG.y;
	Model.PilotEyePos.z = c1.Z - CG.z;

	SHAPE.GetContactPoint(ControlledAC, CT_WHLBACK, w, c1, c2);
	PGEAR pTail = new GEAR (pModel, TAIL);
	pTail->SetDimensions (c1.X - CG.x, c1.Y - CG.y, c1.Z - CG.z, c2.X - CG.x, c2.Y - CG.y, c2.Z - CG.z);
	pTail->SetSuspension (10000, 250000);
	pTail->SetTyres (0.02, 0.75, 0);

	SHAPE.GetContactPoint(ControlledAC, CT_WHLLEFT, w, c1, c2);
	PGEAR pMainPort = new GEAR (pModel, PORT);
	pMainPort->SetDimensions (c1.X - CG.x, c1.Y - CG.y, c1.Z - CG.z, c2.X - CG.x, c2.Y - CG.y, c2.Z - CG.z);
	pMainPort->SetSuspension (40000, 1000000);
	pMainPort->SetTyres (0.02, 0.75, 10000);
	
	SHAPE.GetContactPoint(ControlledAC, CT_WHLRIGHT, w, c1, c2);
	PGEAR pMainStbd = new GEAR (pModel, STBD);
	pMainStbd->SetDimensions (c1.X - CG.x, c1.Y - CG.y, c1.Z - CG.z, c2.X - CG.x, c2.Y - CG.y, c2.Z - CG.z);
	pMainStbd->SetSuspension (40000, 1000000);
	pMainStbd->SetTyres (0.02, 0.75, 10000);

	
	Model.ControlForce = 100;			// Relative amount of force feedback
	Model.BuffetForce  = 100; 

	pModel->SetMassInertias (ControlledAC, 0.75*26500, 0.75*36800, 0.75*11000);				//0.75 * F80
//DeadCode CSB 22/03/99		pModel->SetMassInertias (ControlledAC, 18460, 30000, 8100);		//Don't know
//DeadCode CSB 22/03/99		pModel->SetMassInertias (ControlledAC, 26500, 36800, 11000);	//F86E

	Model.MaxG = 9;
	Model.MinG = -5;

	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.aileron, &adptr->acaileronr);
	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.aileron, &adptr->acaileronl,32767,-32768);//RJS 14May98
	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.elevator, &adptr->acelevator,32767,-32768);//RJS 14May98
	new MODELANIM (ControlledAC,MA_SURFACE, pModel, &ControlledAC->fly.rudder, &adptr->acrudder);
	new MODELANIM (ControlledAC,MA_GENERICFP, pModel, &ControlledAC->fly.rpm, &adptr->acrpm, 0, 65536);
//	new MODELANIM (ControlledAC,MA_GENERICFP, pModel, &pModel->Inst.Rpm1, &adptr->acrpm, 0, 65536);
	new MODELANIM (ControlledAC,MA_SUSPENSION, pTail, &adptr->aclegsuspb, 0, 255);
	new MODELANIM (ControlledAC,MA_SUSPENSION, pMainPort, &adptr->aclegsuspl, 0, 255);
	new MODELANIM (ControlledAC,MA_SUSPENSION, pMainStbd, &adptr->aclegsuspr, 0, 255);

//DeadCode AMM 29Jun99 	Model.CoordRudder = 768;
	Model.PowerBoost = 1.4;

//DeadCode AMM 29Jun99 	Model.ContrailBand = FEET2CM(10000);
	Model.ContrailDuration = 1.0;

	F51D_SetupAI (ControlledAC, Version);
}