General Question Atlantis recompile

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
Yes. I looked at the code. It builds the tank and srb when added. So one can't just add the vessel. You can't just add a MS2015 either.

So if we go with MS2015. I may try and just make the shuttle part seperate and apart of tank and srbs.

On the shuttle going to add the improved rms. I might also add lights for the crago bay an eva.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
So. I copied over the whole Atlantis solution and then remove parts. all the tank, srb and ascent mfd. This was because we are going to just the shuttle part with MS2015.

So the question is how to determine either airfoils or rcs?

Code:
Atlantis::Atlantis (OBJHANDLE hObj, int fmodel)
: VESSEL4 (hObj, fmodel)
{
#ifdef _DEBUG
        // D. Beachy: for BoundsChecker debugging
        GrowStack();
#endif
	int i;

	plop            = new PayloadBayOp (this);
//	ascap           = new AscentAP (this);
//	ascapMfdId      = RegisterAscentApMfd ();
	status          = 3;
	gear_status     = AnimState::CLOSED;
	gear_proc       = 0.0;
	ldoor_drag      = rdoor_drag = 0.0;
	spdb_status     = AnimState::CLOSED;
	spdb_proc       = 0.0;

	engine_light_level = 0.0;
	COLOUR4 col_diff = {1,0.8,0.8,0};
	COLOUR4 col_zero = {0,0,0,0};
	engine_light = AddPointLight (_V(0,0,-25), 300, 2e-4, 0, 4e-4, col_diff, col_zero, col_zero);
	engine_light->SetIntensityRef (&engine_light_level);

	LoadMeshes();
	reset_sat       = false;
	render_cockpit  = false;

	for (i = 0; i < 10; i++)
		mfdbright[i] = 1.0;

	// propellant resources
	ph_oms  = CreatePropellantResource (ORBITER_MAX_PROPELLANT_MASS); // OMS propellant
	SetDefaultPropellantResource (ph_oms); // display OMS tank level in generic HUD

	// Orbiter engines	
	CreateSSME(); // main thrusters
	CreateOMS();  // OMS thrusters (activated only after tank separation)
	CreateRCS();  // Reaction control system (activated only after tank separation)

	// Animations
	DefineAnimations();

	// Aerodynamics
	CreateAirfoils();


Code:
// --------------------------------------------------------------
// Attitude controls (RCS) during orbital phase
// Inactive by default. Activated with EnableRCS(true)
// --------------------------------------------------------------
void Atlantis::CreateRCS()
{
	SURFHANDLE tex_rcs = oapiRegisterExhaustTexture ("Exhaust_atrcs");
	const double eh = 6.0;             // exhaust length scale
	const double ew1 = 0.4, ew2 = 0.8; // exhaust width scales

	// set of attitude thrusters (idealised). The arrangement is such that no angular
	// momentum is created in linear mode, and no linear momentum is created in rotational mode.
	THRUSTER_HANDLE th_att_rot[4], th_att_lin[4];
	th_att_rot[0] = th_att_lin[0] = CreateThruster (_V(0,0, 15.5), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[1] = th_att_lin[3] = CreateThruster (_V(0,0,-15.5), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[2] = th_att_lin[2] = CreateThruster (_V(0,0, 15.5), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[3] = th_att_lin[1] = CreateThruster (_V(0,0,-15.5), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	CreateThrusterGroup (th_att_rot,   2, THGROUP_ATT_PITCHUP);
	CreateThrusterGroup (th_att_rot+2, 2, THGROUP_ATT_PITCHDOWN);
	CreateThrusterGroup (th_att_lin,   2, THGROUP_ATT_UP);
	CreateThrusterGroup (th_att_lin+2, 2, THGROUP_ATT_DOWN);

	AddExhaust (th_att_rot[0], eh, ew1, _V( 1.60,-0.20, 18.78), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F2D
	AddExhaust (th_att_rot[0], eh, ew1, _V( 1.68,-0.18, 18.40), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F4D
	AddExhaust (th_att_rot[0], eh, ew1, _V(-1.55,-0.20, 18.78), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F1D
	AddExhaust (th_att_rot[0], eh, ew1, _V(-1.63,-0.18, 18.40), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F3D

	AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.30), _V(0, 1,0), tex_rcs);//L4U
	AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.70), _V(0, 1,0), tex_rcs);//L2U
	AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-13.10), _V(0, 1,0), tex_rcs);//L1U

	AddExhaust (th_att_rot[1], eh, ew1, _V( 3.43, 3.20,-12.30), _V(0, 1,0), tex_rcs);//R4U
	AddExhaust (th_att_rot[1], eh, ew1, _V( 3.43, 3.20,-12.70), _V(0, 1,0), tex_rcs);//R2U
	AddExhaust (th_att_rot[1], eh, ew1, _V( 3.43, 3.20,-13.10), _V(0, 1,0), tex_rcs);//R1U

	AddExhaust (th_att_rot[2], eh, ew1, _V(-0.4 , 1.10, 18.3 ), _V(0, 1,0), tex_rcs);//F1U	
	AddExhaust (th_att_rot[2], eh, ew1, _V( 0.0 , 1.15 ,18.3 ), _V(0, 1,0), tex_rcs);//F3U
	AddExhaust (th_att_rot[2], eh, ew1, _V( 0.4 , 1.10, 18.3 ), _V(0, 1,0), tex_rcs);//F2U

	AddExhaust (th_att_rot[3], eh, ew1, _V(-3.1 , 1.55,-12.45), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L4D
	AddExhaust (th_att_rot[3], eh, ew1, _V(-3.1 , 1.6 ,-12.8 ), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L2D
	AddExhaust (th_att_rot[3], eh, ew1, _V(-3.1 , 1.65,-13.15), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L3D

	AddExhaust (th_att_rot[3], eh, ew1, _V( 3.15, 1.55,-12.45), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R4D
	AddExhaust (th_att_rot[3], eh, ew1, _V( 3.15, 1.6 ,-12.8 ), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R2D
	AddExhaust (th_att_rot[3], eh, ew1, _V( 3.15, 1.65,-13.15), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R3D

	th_att_rot[0] = th_att_lin[0] = CreateThruster (_V(0,0, 15.5), _V(-1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[1] = th_att_lin[3] = CreateThruster (_V(0,0,-15.5), _V( 1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[2] = th_att_lin[2] = CreateThruster (_V(0,0, 15.5), _V( 1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[3] = th_att_lin[1] = CreateThruster (_V(0,0,-15.5), _V(-1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	CreateThrusterGroup (th_att_rot,   2, THGROUP_ATT_YAWLEFT);
	CreateThrusterGroup (th_att_rot+2, 2, THGROUP_ATT_YAWRIGHT);
	CreateThrusterGroup (th_att_lin,   2, THGROUP_ATT_LEFT);
	CreateThrusterGroup (th_att_lin+2, 2, THGROUP_ATT_RIGHT);

	AddExhaust (th_att_rot[0], eh, ew2, _V( 1.8 ,-0.3 , 18.0 ), _V( 1,0,0), tex_rcs);//F4R
	AddExhaust (th_att_rot[0], eh, ew2, _V( 1.75, 0.1 , 18.05), _V( 1,0,0), tex_rcs);//F2R
	AddExhaust (th_att_rot[2], eh, ew2, _V(-1.7 ,-0.3 , 18.0 ), _V(-1,0,0), tex_rcs);//F1L
	AddExhaust (th_att_rot[2], eh, ew2, _V(-1.65,-0.1 , 18.05), _V(-1,0,0), tex_rcs);//F3L

	AddExhaust (th_att_rot[1], eh, ew2, _V(-4.0 , 2.35,-12.35), _V(-1,0,0), tex_rcs);//L4L
	AddExhaust (th_att_rot[1], eh, ew2, _V(-4.0 , 2.35,-12.6 ), _V(-1,0,0), tex_rcs);//L2L
	AddExhaust (th_att_rot[1], eh, ew2, _V(-4.0 , 2.35,-13.0 ), _V(-1,0,0), tex_rcs);//L3L
	AddExhaust (th_att_rot[1], eh, ew2, _V(-4.0 , 2.35,-13.35), _V(-1,0,0), tex_rcs);//L1L

	AddExhaust (th_att_rot[3], eh, ew2, _V( 4.0 , 2.35,-12.35), _V( 1,0,0), tex_rcs);//R4R
	AddExhaust (th_att_rot[3], eh, ew2, _V( 4.0 , 2.35,-12.6 ), _V( 1,0,0), tex_rcs);//R2R
	AddExhaust (th_att_rot[3], eh, ew2, _V( 4.0 , 2.35,-13.0 ), _V( 1,0,0), tex_rcs);//R3R
	AddExhaust (th_att_rot[3], eh, ew2, _V( 4.0,  2.35,-13.35), _V( 1,0,0), tex_rcs);//R1R

	th_att_rot[0] = CreateThruster (_V( 2.7,0,0), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[1] = CreateThruster (_V(-2.7,0,0), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[2] = CreateThruster (_V(-2.7,0,0), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_rot[3] = CreateThruster (_V( 2.7,0,0), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	CreateThrusterGroup (th_att_rot,   2, THGROUP_ATT_BANKLEFT);
	CreateThrusterGroup (th_att_rot+2, 2, THGROUP_ATT_BANKRIGHT);

	AddExhaust (th_att_rot[0], eh, ew1, _V( 1.60,-0.20, 18.78), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F2D
	AddExhaust (th_att_rot[0], eh, ew1, _V( 1.68,-0.18, 18.40), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F4D
	AddExhaust (th_att_rot[2], eh, ew1, _V(-1.55,-0.20, 18.78), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F1D
	AddExhaust (th_att_rot[2], eh, ew1, _V(-1.63,-0.18, 18.40), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F3D

	AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.30), _V(0, 1,0), tex_rcs);//L4U
	AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.70), _V(0, 1,0), tex_rcs);//L2U
	AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-13.10), _V(0, 1,0), tex_rcs);//L1U

	AddExhaust (th_att_rot[3], eh, ew1, _V( 3.43, 3.20,-12.30), _V(0, 1,0), tex_rcs);//R4U
	AddExhaust (th_att_rot[3], eh, ew1, _V( 3.43, 3.20,-12.70), _V(0, 1,0), tex_rcs);//R2U
	AddExhaust (th_att_rot[3], eh, ew1, _V( 3.43, 3.20,-13.10), _V(0, 1,0), tex_rcs);//R1U

	AddExhaust (th_att_rot[2], eh, ew1, _V(-3.1 , 1.55,-12.45), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L4D
	AddExhaust (th_att_rot[2], eh, ew1, _V(-3.1 , 1.6 ,-12.8 ), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L2D
	AddExhaust (th_att_rot[2], eh, ew1, _V(-3.1 , 1.65,-13.15), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L3D

	AddExhaust (th_att_rot[0], eh, ew1, _V( 3.15, 1.55,-12.45), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R4D
	AddExhaust (th_att_rot[0], eh, ew1, _V( 3.15, 1.6 ,-12.8 ), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R2D
	AddExhaust (th_att_rot[0], eh, ew1, _V( 3.15, 1.65,-13.15), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R3D

	th_att_lin[0] = CreateThruster (_V(0,0,-16), _V(0,0, 1), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	th_att_lin[1] = CreateThruster (_V(0,0, 16), _V(0,0,-1), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
	CreateThrusterGroup (th_att_lin,   1, THGROUP_ATT_FORWARD);
	CreateThrusterGroup (th_att_lin+1, 1, THGROUP_ATT_BACK);

	AddExhaust (th_att_lin[0], eh, ew1, _V(-3.59, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//L1A
	AddExhaust (th_att_lin[0], eh, ew1, _V(-3.27, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//L3A
	AddExhaust (th_att_lin[0], eh, ew1, _V( 3.64, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//R1A
	AddExhaust (th_att_lin[0], eh, ew1, _V( 3.27, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//R3A

	AddExhaust (th_att_lin[1], eh, ew1, _V( 0.0 , 0.75, 19.2 ), _V(0, 0.0499, 0.9988), tex_rcs);//F3F
	AddExhaust (th_att_lin[1], eh, ew1, _V(-0.4 , 0.7 , 19.2 ), _V(0, 0.0499, 0.9988), tex_rcs);//F1F
	AddExhaust (th_att_lin[1], eh, ew1, _V( 0.4 , 0.7 , 19.2 ), _V(0, 0.0499, 0.9988), tex_rcs);//F2F
}

// --------------------------------------------------------------
// Initialise airfoils, aerodynamic control surfaces and drag elements
// --------------------------------------------------------------
void Atlantis::CreateAirfoils ()
{
	CreateAirfoil (LIFT_VERTICAL,   _V(0,0,-0.5), VLiftCoeff, 20, 270, 2.266);
	CreateAirfoil (LIFT_HORIZONTAL, _V(0,0,-4), HLiftCoeff, 20,  50, 1.5);

	CreateControlSurface (AIRCTRL_ELEVATOR, 5.0, 1.5, _V( 0, 0,  -15), AIRCTRL_AXIS_XPOS, anim_elev);
	CreateControlSurface (AIRCTRL_RUDDER,   2.0, 1.5, _V( 0, 3,  -16), AIRCTRL_AXIS_YPOS, anim_rudder);
	CreateControlSurface (AIRCTRL_AILERON,  3.0, 1.5, _V( 7,-0.5,-15), AIRCTRL_AXIS_XPOS, anim_raileron);
	CreateControlSurface (AIRCTRL_AILERON,  3.0, 1.5, _V(-7,-0.5,-15), AIRCTRL_AXIS_XNEG, anim_laileron);

	CreateVariableDragElement (&spdb_proc, 5, _V(0, 7.5, -14)); // speedbrake drag
	CreateVariableDragElement (&gear_proc, 2, _V(0,-3,0));      // landing gear drag
	CreateVariableDragElement (&rdoor_drag, 7, _V(2.9,0,10));   // right cargo door drag
	CreateVariableDragElement (&ldoor_drag, 7, _V(-2.9,0,10));  // right cargo door drag
}

Code:
// --------------------------------------------------------------
// Enable/disable Reaction Control System
// --------------------------------------------------------------
void Atlantis::EnableRCS (bool enable)
{
	PROPELLANT_HANDLE hProp = (enable ? ph_oms : NULL);
	DWORD i;

	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_PITCHUP); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_PITCHUP, i), hProp);
	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_PITCHDOWN); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_PITCHDOWN, i), hProp);

	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_YAWLEFT); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_YAWLEFT, i), hProp);
	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_YAWRIGHT); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_YAWRIGHT, i), hProp);

	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_BANKLEFT); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_BANKLEFT, i), hProp);
	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_BANKRIGHT); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_BANKRIGHT, i), hProp);

	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_UP); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_UP, i), hProp);
	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_DOWN); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_DOWN, i), hProp);

	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_LEFT); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_LEFT, i), hProp);
	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_RIGHT); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_RIGHT, i), hProp);

	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_FORWARD); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_FORWARD, i), hProp);
	for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_BACK); i++)
		SetThrusterResource (GetGroupThruster (THGROUP_ATT_BACK, i), hProp);

	bool enable_as = (GetAttitudeMode() == RCS_NONE || enable == false);
	SetADCtrlMode (enable_as ? 7 : 0);
}
Code:
void Atlantis::clbkPostCreation ()
{

	EnableSSME(status < 3);
	EnableRCS(status == 3);
	EnableOMS(status == 3);
	SetADCtrlMode(status < 3 ? 0 : 7);}

Right now in space the RCS fires and the control surfaces move, which is wrong. Not sure what tells it to stop rcs and use control surfaces or use control surfaces and no rcs?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
So i am just using the shuttle part not the et, srbs.

o3jp4Z1.jpg


Removed ODS and added the new RMS arm.
iGKXSxL.jpg

But I have an issue with the rms code. For some reason the Shoulder yaw and wrist roll, and wrist yaw when moved give a ctd. If I move them using the dialogue window or set in the scn.
Code:
// ***** 8. RMS arm animation *****
	// Note that the animation components can't be declared static here, since
	// their rotation parameters are modified by the respective parent transforms

	ANIMATIONCOMPONENT_HANDLE parent, parent2;

	static UINT RMSShoulderYawGrp[1] = { GRP_Shoulder_Yaw };
	rms_anim[0] = new MGROUP_ROTATE(midx, RMSShoulderYawGrp, 1,
		_V(-2.461, 1.487, 8.776), _V(0, 1, 0), (float)(-360*RAD)); // -180 .. +180
	anim_arm_sy = CreateAnimation(0.5);
	parent = AddAnimationComponent(anim_arm_sy, 0, 1, rms_anim[0]);

	static UINT RMSShoulderPitchGrp[1] = { GRP_SHOULDER_BOOM };
	rms_anim[1] = new MGROUP_ROTATE (midx, RMSShoulderPitchGrp, 1,
		_V(-2.461, 2.031, 8.764), _V(1, 0, 0), (float)(147*RAD)); // -2 .. +145
	anim_arm_sp = CreateAnimation(0.0136);
	parent = AddAnimationComponent (anim_arm_sp, 0, 1, rms_anim[1], parent);

	static UINT RMSElbowPitchGrp[2] = { GRP_ELBOW_BOOM, GRP_ELBOW_CAM_BASE };
	rms_anim[2] = new MGROUP_ROTATE (midx, RMSElbowPitchGrp, 2,
		_V(-2.5835,  1.841633,  2.41351), _V(1, 0, 0), (float)(-163.4*RAD)); // -160 .. +2
	anim_arm_ep = CreateAnimation(0.0123);
	parent = AddAnimationComponent (anim_arm_ep, 0, 1, rms_anim[2], parent);
	
	//RMS elbow camera
	static UINT RMSElbowCamGrp[2] = { GRP_ELBOW_CAM, GRP_PANTILT_ELBOW_CAM };
	MGROUP_ROTATE* pRMSElbowCamPan = new MGROUP_ROTATE(midx, RMSElbowCamGrp + 1, 1,
		_V(-2.54439, 0.145388, 0.15683), _V(0.397185, 0.917739, 0), (float)(340 * RAD));
	
	anim_camRMSElbow[PAN] = CreateAnimation(0.5);
	parent2 = AddAnimationComponent(anim_camRMSElbow[PAN], 0, 1, pRMSElbowCamPan, parent);

	MGROUP_ROTATE* pRMSElbowCamTilt = new MGROUP_ROTATE(midx, RMSElbowCamGrp, 1,
		_V(-2.46462, 0.343234, 0.15463), _V(0.917758, -0.397141, 0), (float)(340 * RAD));
	anim_camRMSElbow[TILT] =CreateAnimation(0.5);
	parent2 = AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamTilt, parent2);
	
	MGROUP_ROTATE* pRMSElbowCamLoc = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(camRMSElbowLoc), 3,
		_V(-2.37968, 0.296129, -0.0332794), _V(1, 0, 0), 0.0f);
	AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamLoc, parent2);

	static UINT RMSWristPitchGrp[1] = { GRP_Wristpitch };
	rms_anim[3] = new MGROUP_ROTATE (midx, RMSWristPitchGrp, 1,
		_V(-2.60695 , 2.017606, - 4.637086), _V(1, 0, 0), (float)(242 * RAD)); // -120 .. +120
	anim_arm_wp = CreateAnimation (0.5);
	parent = AddAnimationComponent (anim_arm_wp, 0, 1, rms_anim[3], parent);

	static UINT RMSWristYawGrp[1] = { GRP_Wrist_Yaw };
	rms_anim[4] = new MGROUP_ROTATE (midx, RMSWristYawGrp, 1,
		_V(-2.60695,  1.883633, - 5.137431), _V(0, 1, 0), (float)(-242.6*RAD)); // -120 .. +120
	anim_arm_wy = CreateAnimation (0.5);
	parent = AddAnimationComponent (anim_arm_wy, 0, 1, rms_anim[4], parent);

	static UINT RMSEndEffectorGrp[1] = { GRP_Endeffector };
	rms_anim[5] = new MGROUP_ROTATE(midx, RMSEndEffectorGrp, 1,
		_V(-2.59965,  2.010648, - 6.343711), _V(0, 0, 1), (float)(894 * RAD));  // -447 .. +447
	anim_arm_wr = CreateAnimation(0.5);
	parent = AddAnimationComponent(anim_arm_wr, 0, 1, rms_anim[5], parent);

	rms_anim[6] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm_tip), 6,
		_V(-2.59965, 2.010648, -6.343711), _V(0, 0, 1), (float)(894 * RAD));  // -447 .. +447
	
	anim_rms_ee = CreateAnimation(0.0);
	AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[6] , parent);

I basically used the existing rms code and changed the mesh names and axis points. Added the rms camera stuff.
 
Last edited:

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Well, you could either look long and hard at the code and try to figure out what is amiss,

or

you could run it in the debugger to see where the CTD occurs and figure it out from there.

The second method is much faster and easier.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
Thanks. I guess I should put a break in the code where it reads the input from the dialogue window? I am thinking it is something in the animation set up.

---------- Post added at 07:35 PM ---------- Previous post was at 10:32 AM ----------

Well here is something I need help in:
Code:
void Atlantis::SeparateMMU (void)
{
	// Create MMU at docking port
	DOCKHANDLE hDock = GetDockHandle (0);
	if (GetDockStatus(hDock)) return; // something is already attached to this docking port

	int i;
	char name[256];
	OBJHANDLE hVessel;
	for (i = 0; ; i++) {
		sprintf (name, "%s-MMU-%d", GetName(), i+1);
		hVessel = oapiGetVesselByName(name);
		if (!hVessel) break;
	}

	VESSELSTATUS vs;
	GetStatus (vs);
	hMMU = oapiCreateVessel (name, "Nasa_MMU", vs);
	Dock (hMMU, 0, 0, 1);
	oapiSetFocusObject (hMMU);
}

So this makes a MMU guy. But not sure how to get the guy back in.
When it make the guy this is what it looks like:
STS-3-MMU-1:Nasa_MMU
STATUS Orbiting Earth
RPOS -4790871.264 -3374842.328 3245593.871
RVEL -3330.4954 -1755.0811 -6655.6318
AROT 97.183 -58.580 34.770
AFCMODE 7
PRPLEVEL 0:1.000000
DOCKINFO 0:0,STS-3
NAVFREQ 0 0
END

Code:
void Atlantis::ENTER_MMU(void)
{
	//if ((HATCH_proc > .8) && (EVA = 1)){
	if (EXT_proc == 1){//hatch open
		// Create MMU at docking port
		DOCKHANDLE hDock = GetDockHandle(1);
		if (GetDockStatus(hDock)) return; // something is already attached to this docking port

		for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
			OBJHANDLE hV = oapiGetVesselByIndex(i);    //get handle for ship
			// if (strncmp (hV->GetVesselByName(), "OBLIVIONBIKE1", 12)!=0  ){
			OBJHANDLE Focusvessel = oapiGetVesselByName("Nasa_MMU");


			oapiDeleteVessel(Focusvessel);
			//SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
			//EVA = 0;
			//oapiSetFocusObject(hMMU);
		}
		//}
	}
}
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Well here is something I need help in:
Does that mean you have fixed your CTD problem, or have you given up on that?
So this makes a MMU guy. But not sure how to get the guy back in.
That should be pretty straightforward:
  • listen to docking events (clbkDockEvent)
  • If the docked vessel is an MMU, delete it
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
refocused.


And I got the mmu part to work. We are going to try to have 3 eva guys. So 3 sets of keys. Eva guy1 -E eva guy 2 -W and eva guy 3. That way 3 different mesh/guys are made and created.

---------- Post added 02-14-18 at 07:14 AM ---------- Previous post was 02-13-18 at 07:41 AM ----------

New issue. We have noticed when we eva. It makes a NASAMMu vessel. Switch focus to the mmu vessel. BUT when you apply thrust the shuttle rcs fire.

No idea where to look in the code.

---------- Post added at 05:46 PM ---------- Previous post was at 07:14 AM ----------

So here is the Scn:
Code:
BEGIN_FOCUS
  Ship MMU1
END_FOCUS

BEGIN_CAMERA
  TARGET MMU1
  MODE Extern
  POS 8.466217 84.081557 105.710714
  TRACKMODE TargetRelative
  FOV 40.00
END_CAMERA

BEGIN_HUD
  TYPE Surface
END_HUD

BEGIN_MFD Left
  TYPE Orbit
  PROJ Ship
  FRAME Ecliptic
  REF Earth
END_MFD

BEGIN_MFD Right
  TYPE User
  MODE Multistage2015_MFD
END_MFD

BEGIN_SHIPS
ET-3:Multistage2015
  STATUS Orbiting Earth
  RPOS 3531435.752 1989435.578 5120047.757
  RVEL -4925.2405 -3576.4305 4948.5147
  AROT -1.081 2.084 -122.784
  AFCMODE 7
  PRPLEVEL 0:0.060118
  NAVFREQ 0 0 0 0
  XPDR 0
  CONFIG_FILE Config\Multistage2015\Space-Shuttle_STS-3new.ini
  GUIDANCE_FILE Config\Multistage2015\Guidance\guidance_shuttle_STS-3.txt
  CONFIGURATION 1
  CURRENT_BOOSTER 2
  CURRENT_STAGE 1
  CURRENT_INTERSTAGE 1
  CURRENT_PAYLOAD 2
  FAIRING 0
  MET 1079.202
  BATTERY 4320.798116
  STAGE_IGNITION_TIME 0.000000
  STAGE_STATE 2
  TELEMETRY_FILE Config\Multistage2015\Telemetry\guidance_shuttle_STS-3.txt
  ALT_STEPS 100.0,350.0,1400.0,35000.0
  PEG_PITCH_LIMIT 35.000
  PEG_MC_INTERVAL 0.100
END
MS_Camera:MS_Camera
  STATUS Landed Earth
  POS -80.6238630 28.6070927
  HEADING 180.57
  ALT 0.000
  AROT -118.284 -4.474 171.752
  AFCMODE 7
  NAVFREQ 0 0
  TARGET ET-3
END
STS-3:ShuttleConstellation2016NEW
  STATUS Orbiting Earth
  RPOS 3531135.359 1989248.168 5120117.587
  RVEL -4925.9468 -3576.8869 4948.6340
  AROT -128.055 20.161 -23.596
  VROT 0.2330 -0.0010 0.1464
  PRPLEVEL 0:0.996248
  THLEVEL 7:0.015554 8:0.015554 9:0.000003 10:0.000003 13:0.000510 14:0.000510
  NAVFREQ 0 0
  CONFIGURATION 3
  GEAR 0 0.0000
  HATCH 1 1.0000
  ARM_STATUS 0.5000 0.0000 0.0000 0.5000 0.5000 0.5000
  SAT_OFS_X 0.000000
  SAT_OFS_Y 0.000000
  SAT_OFS_Z 0.000000
  LIGHT 0 
  CARGODOOR 1 1.0000
END
MMU1:Nasa_MMU
  STATUS Orbiting Earth
  RPOS 3531104.157 1989225.501 5120128.653
  RVEL -4926.1159 -3576.9901 4948.7434
  AROT -127.683 51.955 129.742
  VROT -0.8787 -0.0719 -0.1510
  AFCMODE 7
  NAVFREQ 0 0
END
END_SHIPS
focus is on the MMU. but when I press the rcs control for the mmu the shuttles fire.

here is what I have for the h.
Code:
// ==============================================================
//                 ORBITER MODULE: Atlantis
//                  Part of the ORBITER SDK
//          Copyright (C) 2001-2012 Martin Schweiger
//                   All rights reserved
//
// Atlantis.h
// Class interface of Atlantis (Space Shuttle) vessel class
// module and associated subclasses (SRB, tank)
// ==============================================================

#ifndef __ATLANTIS_H
#define __ATLANTIS_H

#include "orbitersdk.h"
#include <math.h>



// ==========================================================
// Some Orbiter-related parameters
// ==========================================================

const double ORBITER_EMPTY_MASS = 104326.0;
// Orbiter empty mass [kg]

const double ORBITER_MAX_PROPELLANT_MASS = 21600.0;
// Amount of fuel the orbiter can hold in internal OMS tanks

const double ORBITER_MAIN_THRUST = 1668652.0 * 1.25;
// Vacuum thrust rating per main engine [N] (x3 for total)
// assuming vacuum thrust is 5/4 liftoff thrust

const double ORBITER_OMS_THRUST = 26700.0;
// Vacuum thrust per unit for Orbital Maneuvering System [N] (x2 for total)

const double ORBITER_RCS_THRUST = 7740.0;
// Vacuum thrust rating for attitude thrusters (Reaction Control System) [N]

const double ORBITER_MAIN_ISP0 = 4444.0; // 453s*9.81
const double ORBITER_MAIN_ISP1 = 3561.0; // 363s*9.81
// Vacuum and sea-level fuel-specific impulse for orbiter main engines [m/s]
// using H2/O2 (hydrogen/oxygen)

const double ORBITER_OMS_ISP0 = 3100;
const double ORBITER_OMS_ISP1 = 2500;
// Vacuum and sea-level fuel-specific impulse for Orbital Maneuvering System [m/s]
// using MMH/N2O4 (monomethyl hydrazine/nitrogen tetroxide)

const double ORBITER_RCS_ISP0 = 5000.0;
const double ORBITER_RCS_ISP1 = 4000.0;
// Vacuum and sea-level fuel-specific impulse for Reaction Control System [m/s]

const double GEAR_OPERATING_SPEED = 0.3;
// Opening/closing speed of landing gear (1/sec)
// => gear cycle ~ 3 sec

const double DOOR_OPERATING_SPEED = 0.007353;
// Opening/closing speed of payload bay doors (1/sec)
// This contains the door opening sequence (63 sec for each door) and an
// interval of 10 sec between the two door operations

const double RAD_OPERATING_SPEED = 0.025;
// Deployment/stowing speed of radiators (1/sec)
// => radiator cycle = 40 sec

const double RADLATCH_OPERATING_SPEED = 0.2;
// Release/engaging speed of radiator latches (1/sec)
// => radiator latch cycle = 5 sec

const double KU_OPERATING_SPEED = 0.0435;
// Deployment speed of the Ku Band antenna (1/sec)
// cycle is 23 sec

const double SPEEDBRAKE_OPERATING_SPEED = 0.20284;
// Deployment speed of the speedbrake (1/sec)
// cycle is 4.93 sec

const double ARM_OPERATING_SPEED = 0.005;
// RMS arm joint rotation speed (rad/sec)

const VECTOR3 ORBITER_CS = {234.8,389.1,68.2};
// Orbiter cross sections (projections into principal axes) [m^2]

const VECTOR3 ORBITER_CS_GEAR = {10.0,0.0,3.0};
// Contribution of fully extended landing gear to cross sections

const double MAX_GRAPPLING_DIST = 0.5;
// max distance between RMS tip and grappling point for successful grappling


// ==========================================================
// Thruster reference positions and thrust directions
// ==========================================================

const VECTOR3 THRUSTREF_SSME0      = {-1.55,-0.37,-12.5};
const VECTOR3 THRUSTREF_SSME1      = { 1.55,-0.37,-12.5};
const VECTOR3 THRUSTREF_SSME2      = { 0.0,  2.7, -12.5};
const VECTOR3 THRUSTREF_OMSL       = {-2.6,  3.3, -12.8};
const VECTOR3 THRUSTREF_OMSR       = { 2.6,  3.3, -12.8};
const VECTOR3 THRUSTREF_SRB        = { 0.0,  0.0, -20.4};

const double THRUSTPITCH_LAUNCH = -2.3*RAD;
const VECTOR3 THRUSTGIMBAL_LAUNCH = {0, sin(THRUSTPITCH_LAUNCH), cos(THRUSTPITCH_LAUNCH)};

const VECTOR3 THRUSTDIR_OMSL = { 0.19299542, -0.24495572, 0.95013129};
const VECTOR3 THRUSTDIR_OMSR = {-0.19299542, -0.24495572, 0.95013129};

// ==========================================================
// Docking port position
// ==========================================================

//const VECTOR3 ORBITER_DOCKPOS      = { 0.0, 2.40, 10.15};

// ==========================================================
// panel area identifiers
// ==========================================================

// define MFD function buttons
#define AID_CDR1_BUTTONS   1
#define AID_CDR2_BUTTONS   2
#define AID_PLT1_BUTTONS   3
#define AID_PLT2_BUTTONS   4
#define AID_MFD1_BUTTONS   5
#define AID_MFD2_BUTTONS   6
#define AID_MFD3_BUTTONS   7
#define AID_MFD4_BUTTONS   8
#define AID_MFD5_BUTTONS   9
#define AID_MFDA_BUTTONS  10
// D. Beachy: define power buttons
#define AID_CDR1_PWR      11
#define AID_CDR2_PWR      12
#define AID_PLT1_PWR      13
#define AID_PLT2_PWR      14
#define AID_MFD1_PWR      15
#define AID_MFD2_PWR      16
#define AID_MFD3_PWR      17
#define AID_MFD4_PWR      18
#define AID_MFD5_PWR      19
#define AID_MFDA_PWR      20
// MFD brightness buttons
#define AID_CDR1_BRT      21
#define AID_CDR2_BRT      22
#define AID_PLT1_BRT      23
#define AID_PLT2_BRT      24
#define AID_MFD1_BRT      25
#define AID_MFD2_BRT      26
#define AID_MFD3_BRT      27
#define AID_MFD4_BRT      28
#define AID_MFD5_BRT      29
#define AID_MFDA_BRT      30
// Panel R13L (payload bay operations)
#define AID_R13L_MIN     100
#define AID_R13L         100
#define AID_R13L_TKBK1   101
#define AID_R13L_TKBK2   102
#define AID_R13L_TKBK3   103
#define AID_R13L_TKBK4   104
#define AID_R13L_TKBK5   105
#define AID_R13L_TKBK6   106
#define AID_R13L_MAX     120

typedef struct {
	HINSTANCE hDLL;
	SURFHANDLE tkbk_label;
	HFONT font[1];
} GDIParams;

//class Atlantis_Tank;
//class AscentAPDlg;

// ==========================================================
// Interface for derived vessel class: Atlantis
// ==========================================================

class Atlantis: public VESSEL4 {
	//friend class AscentAP;
	friend class PayloadBayOp;
	friend BOOL CALLBACK RMS_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
public:
	AnimState::Action gear_status, spdb_status;
	Atlantis (OBJHANDLE hObj, int fmodel);
	~Atlantis();

	//AscentAP *AscentAutopilot() { return ascap; }
	//int RegisterAscentApMfd();
	//void CreateAscentAPDlg();
	//void DestroyAscentAPDlg();

	//void SeparateBoosters (double srb_time);
	// Jettison both SRBs from ET

//	void SeparateTank ();
	// Jettison ET from orbiter

	void GetSSMEGimbalPos (int which, double &pitch, double &yaw);
	void GetSRBGimbalPos (int which, double &pitch, double &yaw);

	void SeparateMMU (void);
	void ToggleGrapple (void);
	void ToggleArrest (void);
	void SetGearParameters (double state);
	//void Jettison ();
	void UpdateMesh ();
	void SetBayDoorPosition (double pos);
	void SetRadiatorPosition (double pos);
	void SetRadLatchPosition (double pos) {}
	void SetKuAntennaPosition (double pos);
	void SetSSMEPosition (double pos);
	void OperateLandingGear (AnimState::Action action);
	void RevertLandingGear ();
	void OperateSpeedbrake (AnimState::Action action);
	void RevertSpeedbrake ();
	void SetAnimationArm (UINT anim, double state);

	//double GetSRBThrustLevel (int which);
	// returns the thrust level from left (which=0) or right (which=1)
	// SRB, or 0 if SRB is detached

	void RegisterVC_CdrMFD ();
	void RegisterVC_PltMFD ();
	void RegisterVC_CntMFD ();
	void RegisterVC_AftMFD ();
	void RedrawPanel_MFDButton (SURFHANDLE surf, int mfd);

	int status; // 0=launch configuration
	            // 1=SRB's engaged
	            // 2=SRB's separated
	            // 3=Tank separated (orbiter only)

	double t0;          // reference time: designated liftoff time


	double gear_proc; // landing gear deployment state (0=retracted, 1=deployed)
	//double kubd_proc; // Ku-band antenna deployment state (0=retracted, 1=deployed)
	double spdb_proc; // Speedbrake deployment state (0=retracted, 1=deployed)
	double ldoor_drag, rdoor_drag; // drag components from open cargo doors
	bool center_arm;
	bool arm_moved, arm_scheduled;
	double center_arm_t;
	bool do_eva;
	bool do_plat;
	bool do_cargostatic;
	VECTOR3 ofs_sts_sat;
	VECTOR3 cargo_static_ofs;
	VISHANDLE vis;      // handle for visual - note: we assume that only one visual per object is created!
	MESHHANDLE hOrbiterMesh, hOrbiterCockpitMesh, hOrbiterVCMesh; // mesh handles
	char cargo_static_mesh_name[256];
	ATTACHMENTHANDLE sat_attach, rms_attach;
	VECTOR3 arm_tip[3];

	// Overloaded callback functions
	void clbkSetClassCaps (FILEHANDLE cfg);
	void clbkSetStateEx (const void *status);
	void clbkLoadStateEx (FILEHANDLE scn, void *vs);
	void clbkSaveState (FILEHANDLE scn);
	void clbkPostCreation ();
	void clbkFocusChanged (bool getfocus, OBJHANDLE hNewVessel, OBJHANDLE hOldVessel);
	void clbkPreStep (double simt, double simdt, double mjd);
	bool clbkPlaybackEvent (double simt, double event_t, const char *event_type, const char *event);
	int  clbkConsumeBufferedKey (DWORD key, bool down, char *kstate);
	void clbkVisualCreated (VISHANDLE vis, int refcount);
	void clbkVisualDestroyed (VISHANDLE vis, int refcount);
	void clbkAnimate (double simt);
	void clbkMFDMode (int mfd, int mode);
	void clbkRCSMode (int mode);
	bool clbkLoadGenericCockpit ();
	bool clbkLoadVC (int id);
	bool clbkVCMouseEvent (int id, int event, VECTOR3 &p);
	bool clbkVCRedrawEvent (int id, int event, SURFHANDLE surf);
	bool clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp);

	PayloadBayOp *plop; // control and status of payload bay operations


	void Revertextdoor(void);
	void ENTER_MMU(void);

protected:
	void LoadMeshes();
	// Load the meshes for cockpit and exterior

	void CreateSSME();
	// Initialise the thrusters for the shuttle main engines

	void CreateOMS();
	// Initialise the thrusters for the orbital maneuvering system

	void CreateRCS();
	// Initialise the thrusters for the reaction control system

	void CreateAirfoils();
	// Initialise airfoils, aerodynamic control surfaces and drag elements

	static void VLiftCoeff (double aoa, double M, double Re, double *cl, double *cm, double *cd);
	static void HLiftCoeff (double beta, double M, double Re, double *cl, double *cm, double *cd);
	// airfoil coefficient functions

	void DefineAnimations (void);
	// Initialises all animation objects
	//
	enum hatch_status { HATCH_UP, HATCH_DOWN, HATCH_RAISING, HATCH_LOWERING } EXT_status, ods_status;;
	//
private:
	void SetSSMEGimbal (const VECTOR3 &angle);
	// Set the gimbal positions for the shuttle main engines

	double GetAscentPitchRate (double tgt_pitch);
	// Autopilot function: returns the pitch rate for the specified
	// target pitch during launch phase (until ET separation)

	void AutoGimbal (const VECTOR3 &tgt_rate);
	// Automatic gimbal adjustment for SSME and SRB engines to correct
	// for CG shift, SRB thrust variations, atmospheric effects, etc.

	void AutoRCS (const VECTOR3 &tgt_rate);
	// Automatic RCS control for ascent autopilot

	//void LaunchClamps();
	bool EnableSSME (bool enable);
	void EnableOMS (bool enable);
	void EnableRCS (bool enable);

	bool SatGrappled() const { return GetAttachmentStatus (rms_attach) != 0; }
	bool SatStowed() const { return GetAttachmentStatus (sat_attach) != 0; }
	ATTACHMENTHANDLE CanArrest() const;

	//AscentAP *ascap;                           // ascent autopilot
	//int ascapMfdId;                            // ID for ascent autopilot MFD mode
	//Atlantis_Tank *pET;                        // pointer to ET object (if attached)
	DOCKHANDLE hDockET;                        // docking connector to ET

	VECTOR3 gimbal_pos;                        // gimbal settings for pitch,yaw,roll

	UINT anim_door;                            // handle for cargo door animation

	UINT anim_extdoor;                            // handle for cargo door animation


	UINT anim_rad;                             // handle for radiator animation
	UINT anim_gear;                            // handle for landing gear animation
	UINT anim_kubd;                            // handle for Ku-band antenna animation
	UINT anim_elev;                            // handle for elevator animation
	UINT anim_laileron;						   // handle for left aileron animation
	UINT anim_raileron;						   // handle for right aileron animation
	UINT anim_rudder;						   // handle for rudder animation
	UINT anim_spdb;                            // handle for speed brake animation
	UINT anim_ssme;                            // handle for SSME pitch gimbal animation
	UINT mesh_orbiter;                         // index for orbiter mesh
	UINT mesh_cockpit;                         // index for cockpit mesh for external view
	UINT mesh_vc;                              // index for virtual cockpit mesh
	UINT mesh_cargo;                           // index for static cargo mesh
	UINT mesh_platform;                        // index for payload platform mesh
	PROPELLANT_HANDLE ph_oms;                  // handles for propellant resources
	THRUSTER_HANDLE th_main[3];                // handles for orbiter main engines
	THRUSTER_HANDLE th_oms[2];                 // handles for orbiter oms engines
	THGROUP_HANDLE thg_main, thg_oms;          // handles for thruster groups

	// RMS arm animation status
	ANIMATIONCOMPONENT_HANDLE hAC_arm, hAC_sat, hAC_satref;
	MGROUP_TRANSFORM *rms_anim[6];
	MGROUP_TRANSFORM *ssme_anim[3];
	UINT anim_arm_sy, anim_arm_sp, anim_arm_ep, anim_arm_wp, anim_arm_wy, anim_arm_wr;
	double arm_sy, arm_sp, arm_ep, arm_wp, arm_wy, arm_wr;
	MGROUP_TRANSFORM *sat_anim, *sat_ref;
	bool reset_sat;
	OBJHANDLE hMMU, hSAT;
	bool render_cockpit;
	double mfdbright[10];
	//
	double  EXT_proc;
	//
	LightEmitter *engine_light;
	double engine_light_level;
	double DYNPRESSURE;  //get DYNAMIC pressure for rcs or control surfaces

	int light_status;
	SpotLight *spotlight1, *spotlight2, *spotlight3, *spotlight4, *spotlight5, *spotlight6;
	BEACONLIGHTSPEC spot_beacon[8];
	VECTOR3 beacon_col = _V(0.75, 0.75, 0.75);

















};


#endif // !__ATLANTIS_H


---------- Post added 02-15-18 at 05:46 AM ---------- Previous post was 02-14-18 at 05:46 PM ----------

So got that fixed.
I was a left over piece from the Ascentmfd.

I think for for variations the mass, fuel amount may need to be read from the scn?

Thanks for all the help
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
So I was able to add the new rms into the shuttle. BUt having an issue with code.

I can get the attachment to follow the animation.
gCABwhk.jpg
stowed
fdvxzWF.jpg



Code:
arm_tip[0] = _V(-2.607,2,-6.344);
	arm_tip[1] = _V(-2.607,2,-7.344);
	arm_tip[2] = _V(-2.607,1,-6.344);

	sat_attach = CreateAttachment (false, ofs_sts_sat, _V(0,1,0), _V(0,0,1), "X");
	rms_attach = CreateAttachment (false, arm_tip[0], arm_tip[1]-arm_tip[0], arm_tip[2]-arm_tip[0], "G", true);


rms arm animation
Code:
void Atlantis::UpdateMesh ()
{
	// update animation states
	SetAnimation (anim_gear, gear_proc);
	SetAnimation (anim_spdb, spdb_proc);
	SetAnimation (anim_door, plop->BayDoorStatus.pos);
	SetAnimation (anim_rad,  plop->RadiatorStatus.pos);
	SetAnimation (anim_kubd, plop->KuAntennaStatus.pos);

	SetAnimationArm (anim_arm_sy, arm_sy);
	SetAnimationArm (anim_arm_sp, arm_sp);
	SetAnimationArm (anim_arm_ep, arm_ep);
	SetAnimationArm (anim_arm_wp, arm_wp);
	SetAnimationArm (anim_arm_wy, arm_wy);
	SetAnimationArm (anim_arm_wr, arm_wr);
	SetAnimationArm(anim_rms_ee, arm_wr);
Code:
// ***** 8. RMS arm animation *****
	// Note that the animation components can't be declared static here, since
	// their rotation parameters are modified by the respective parent transforms

	ANIMATIONCOMPONENT_HANDLE parent, parent2;

	static UINT RMSShoulderYawGrp[1] = { GRP_Shoulder_Yaw };
	rms_anim[0] = new MGROUP_ROTATE(midx, RMSShoulderYawGrp, 1,
		_V(-2.461, 1.487, 8.776), _V(0, 1, 0), (float)(-360*RAD)); // -180 .. +180
	anim_arm_sy = CreateAnimation(0.5);
	parent = AddAnimationComponent(anim_arm_sy, 0, 1, rms_anim[0]);

	static UINT RMSShoulderPitchGrp[1] = { GRP_SHOULDER_BOOM };
	rms_anim[1] = new MGROUP_ROTATE (midx, RMSShoulderPitchGrp, 1,
		_V(-2.461, 2.031, 8.764), _V(1, 0, 0), (float)(147*RAD)); // -2 .. +145
	anim_arm_sp = CreateAnimation(0.0136);
	parent = AddAnimationComponent (anim_arm_sp, 0, 1, rms_anim[1], parent);
	
	static UINT RMSElbowPitchGrp[2] = { GRP_ELBOW_BOOM, GRP_ELBOW_CAM_BASE };
	rms_anim[2] = new MGROUP_ROTATE (midx, RMSElbowPitchGrp, 2,
		_V(-2.5835,  1.841633,  2.41351), _V(1, 0, 0), (float)(-163.4*RAD)); // -160 .. +2
	anim_arm_ep = CreateAnimation(0.0123);
	parent = AddAnimationComponent (anim_arm_ep, 0, 1, rms_anim[2], parent);
	
	//RMS elbow camera
	static UINT RMSElbowCamGrp[2] = { GRP_ELBOW_CAM, GRP_PANTILT_ELBOW_CAM };
	MGROUP_ROTATE* pRMSElbowCamPan = new MGROUP_ROTATE(midx, RMSElbowCamGrp + 1, 1,
		_V(-2.54439, 0.145388, 0.15683), _V(0.397185, 0.917739, 0), (float)(340 * RAD));
	
	anim_camRMSElbow[PAN] = CreateAnimation(0.5);
	parent2 = AddAnimationComponent(anim_camRMSElbow[PAN], 0, 1, pRMSElbowCamPan, parent);

	MGROUP_ROTATE* pRMSElbowCamTilt = new MGROUP_ROTATE(midx, RMSElbowCamGrp, 1,
		_V(-2.46462, 0.343234, 0.15463), _V(0.917758, -0.397141, 0), (float)(340 * RAD));
	anim_camRMSElbow[TILT] =CreateAnimation(0.5);
	parent2 = AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamTilt, parent2);
	
	MGROUP_ROTATE* pRMSElbowCamLoc = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(camRMSElbowLoc), 3,
		_V(-2.37968, 0.296129, -0.0332794), _V(1, 0, 0), 0.0f);
	AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamLoc, parent2);
	
	static UINT RMSWristPitchGrp[1] = { GRP_Wristpitch };
	rms_anim[3] = new MGROUP_ROTATE (midx, RMSWristPitchGrp, 1,
		_V(-2.60695 , 2.017606, - 4.637086), _V(1, 0, 0), (float)(242 * RAD)); // -120 .. +120
	anim_arm_wp = CreateAnimation (0.5);
	parent = AddAnimationComponent (anim_arm_wp, 0, 1, rms_anim[3], parent);
	
	static UINT RMSWristYawGrp[1] = { GRP_Wrist_Yaw };
	rms_anim[4] = new MGROUP_ROTATE (midx, RMSWristYawGrp, 1,
		_V(-2.60695,  1.883633, - 5.137431), _V(0, 1, 0), (float)(-242.6*RAD)); // -120 .. +120
	anim_arm_wy = CreateAnimation (0.5);
	parent = AddAnimationComponent (anim_arm_wy, 0, 1, rms_anim[4], parent);

	static UINT RMSEndEffectorGrp[1] = { GRP_Endeffector };
	rms_anim[5] = new MGROUP_ROTATE(midx, RMSEndEffectorGrp, 1,
		_V(-2.59965,  2.010648, - 6.343711), _V(0, 0, 1), (float)(894 * RAD));  // -447 .. +447
	anim_arm_wr = CreateAnimation(0.5);
	parent = AddAnimationComponent(anim_arm_wr, 0, 1, rms_anim[5], parent);
	
	rms_anim[6] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm_tip), 3,
		_V(-2.59965, 2.010648, -6.343711), _V(0, 0, 1), (float)(894 * RAD));  // -447 .. +447
	
	anim_rms_ee = CreateAnimation(0.5);
	AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[6] , parent);
	hAC_arm = AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[6], parent);

So not sure what this number red'3" should be?
Code:
rms_anim[6] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm_tip), [COLOR="Red"]3[/COLOR],
		_V(-2.59965, 2.010648, -6.343711), _V(0, 0, 1), (float)(894 * RAD));
Then I have the anim rms ee follow the wrist animation state
Code:
lse if (SendDlgItemMessage (hWnd, IDC_WRIST_ROLLLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->arm_wr = max (0.0, sts->arm_wr - (t1-t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm (sts->anim_arm_wr, sts->arm_wr);
				sts->arm_wr = max(0.0, sts->arm_wr - (t1 - t0)*ARM_OPERATING_SPEED);

				sts->SetAnimationArm(sts->anim_rms_ee, sts->arm_wr);
			} else if (SendDlgItemMessage (hWnd, IDC_WRIST_ROLLRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->arm_wr = min (1.0, sts->arm_wr + (t1-t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm (sts->anim_arm_wr, sts->arm_wr);
				sts->arm_wr = max(0.0, sts->arm_wr - (t1 - t0)*ARM_OPERATING_SPEED);

				sts->SetAnimationArm(sts->anim_rms_ee, sts->arm_wr);
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
so reading the API
Code:
Instead of adding mesh groups to an animation, it is also possible to add a
local VECTOR3 array. To do this, set “mesh” to LOCALVERTEXLIST, and
set “grp” to MAKEGROUPARRAY(vtxptr), where vtxptr is the VECTOR3
array. “ngrp” is set to the number of vertices in the array. Example:
VECTOR3 vtx[2] = {_V(0,0,0), _V(1,0,-1)};
MGROUP_TRANSFORM *mt = new MGROUP_TRANSFORM (LOCALVERTEXLIST,
MAKEGROUPARRAY(vtx), 2);
AddAnimationComponent (anim, 0, 1, mt);
Transforming local vertices in this way does not have an effect on the visual
appearance of the animation, but it can be used by the module to keep track
of a transformed point during animation. The Atlantis module uses this
method to track a grappled satellite during animation of the RMS arm.

So the red 3 in my code is the number of vertices, correct.

So are the vertices the joints? in a rms arm?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
So the goal was to make more shuttles. I found that by just coding thew shuttle we can use ms2015 for launches. Then the user may select which srb, et,......

2 versions. #1 Columbia with "old" rms, no ODS
#2 Constellation with new RMs

Both have cameras and rms camera and lights.

But recently I noticed an BIG issue. either the cockpit or VC mesh gets shifted.

7czUKZ9.jpg


from this cockpit view you can see the window frame are no matching up.
OD9vHCB.jpg


I have switched the meshes and no change. I was thinking I moved them

Any ideas? As far as I have seen no shift mesh commands.

I have commented out all animations.

I added a remade shuttle and the same result.

---------- Post added 03-01-18 at 06:06 AM ---------- Previous post was 02-28-18 at 07:14 AM ----------

Not sure if this is a bug or not.
The default Atlantis is forward of the cockpit mesh. The vc is the highlighted mesh.
Ft95aAI.jpg


That why the bars are shown in the vc. I ran this in another Orbiter 2016 and the same. and confirm by another user.

Still no idea why the vc is extending into the shuttle bay.
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,907
Reaction score
205
Points
138
Location
Cape
Can you turn of the VC mesh when you are displaying outside view ?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
Yes

KKGuHUb.jpg

and
e8YuJB6.jpg



Code:
hOrbiterMesh = oapiLoadMeshGlobal("Atlantis\\Atlantis");
	hOrbiterCockpitMesh = oapiLoadMeshGlobal("Atlantis\\AtlantisCockpit");
	hOrbiterVCMesh = oapiLoadMeshGlobal("Atlantis\\AtlantisVC");

	// Load meshes
	mesh_cockpit = AddMesh(hOrbiterCockpitMesh);
	SetMeshVisibilityMode(mesh_cockpit, MESHVIS_EXTERNAL);

	mesh_orbiter = AddMesh(hOrbiterMesh);
	SetMeshVisibilityMode(mesh_orbiter, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);

	mesh_vc = AddMesh(hOrbiterVCMesh);
	SetMeshVisibilityMode(mesh_vc, MESHVIS_VC | MESHVIS_EXTERNAL);
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,907
Reaction score
205
Points
138
Location
Cape
So, does that solve the problem ?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
No. The default Atlantis is like that.

---------- Post added at 05:34 PM ---------- Previous post was at 09:13 AM ----------

So if I do this. Then the vc doesn't come thru the cargobay.
Code:
	mesh_cockpit = AddMesh(hOrbiterCockpitMesh);
	SetMeshVisibilityMode(mesh_cockpit, MESHVIS_EXTERNAL);
	
	mesh_orbiter = AddMesh(hOrbiterMesh);
	SetMeshVisibilityMode(mesh_orbiter, MESHVIS_ALWAYS | MESHVIS_VC );

	mesh_vc = AddMesh(hOrbiterVCMesh);
	SetMeshVisibilityMode(mesh_vc, MESHVIS_ALWAYS | MESHVIS_VC );

But because the VC doesn't match the main mesh there are issues. So I main need to make the cockpit mesh which does fit the vc mesh also with the mfd,........
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
So I redid the vc. But there seems to be a vc-hires and a lo one. Not sure why?

Got the front mfd to work. Thinking about the aft one to make it on the aft wall.

The one function I can't get to work or see the difference was the mfd bright function
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
Ok last but not least

RMS dialogue box. I can add the store/recall boxes.

But not sure how to code them.

I think the save state is stored in the scn. Then when you press read you open the scn and get the values and then like stow it follows a set sequence
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
I have run into a major issue with the vc.

So the mfd and screen have the same texture "label.dds". The screen are id as cdr1,cdr2,....

But the labels for the mfd not.

So I get the cdr1 to work but the cdr2 screen shows but not the label,....

Code:
bool Atlantis::clbkLoadVC (int id)
{
	static VCHUDSPEC huds = {  // common HUD specs
		mesh_vc,            // nmesh
		GRP_VIRTUAL_HUD,  // ngroup
		{0,0,0},            // hudcnt (to be filled)
		0.176558            // size
	};
	//static VCMFDSPEC mfds = {
	//	mesh_vc, 0
	//};
	static EXTMFDSPEC mfds = { // common MFD specs
		{0,0,0,0},          // pos
		mesh_vc,            // nmesh
		0,                  // ngroup (to be filled)
		MFD_SHOWMODELABELS, // flag
		5, 0,               // nbt1, nbt2
		512/6, 512/7        // bt_yofs, bt_ydist
	};
	static const int mfdgrp[10] = {
		GRP_CDR1_VC,GRP_CDR2_VC,GRP_PLT1_VC,GRP_PLT2_VC,
		GRP_MFD1_VC, GRP_MFD2_VC, GRP_MFD3_VC, GRP_MFD4_VC, GRP_MFD5_VC,
		GRP_MFD_AFT_VC
	};

	bool ok = false;

	// register MFD function buttons
	// this needs to be done globally, so that the labels are correctly updated from all VC positions
	SURFHANDLE tex1 = oapiGetTextureHandle (hOrbiterVCMesh, 14);

	// commander MFD function buttons
	oapiVCRegisterArea (AID_CDR1_BUTTONS, _R(0,1,255,14), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_CDR2_BUTTONS, _R(0,15,255,28), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	// pilot MFD function buttons
	oapiVCRegisterArea (AID_PLT1_BUTTONS, _R(0,29,255,42), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_PLT2_BUTTONS, _R(0,43,255,56), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	// central console MFD function buttons
	oapiVCRegisterArea (AID_MFD1_BUTTONS, _R(0, 57,255, 70), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD2_BUTTONS, _R(0, 71,255, 84), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD3_BUTTONS, _R(0, 85,255, 98), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD4_BUTTONS, _R(0, 99,255,112), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD5_BUTTONS, _R(0,113,255,126), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);

In my vc mesh labels is the 14th texture.
Code:
TEXTURES 14
Atlantis/R1L1.dds
Atlantis/c3.dds
Atlantis/A8top.dds
Atlantis/R2.dds
Atlantis/c2.dds
Atlantis/clocknums.dds
Atlantis/A8bottom.dds
Atlantis/STSVC01.dds
Atlantis/STSVC02.dds
Atlantis/STSVC03.dds
Atlantis/r13l.dds
Atlantis/talkback.dds
Atlantis/GPC.dds
Atlantis/label.dds D

So int he Atlantis mesh definition notice the mfd are in sequence
Code:
// Named mesh groups:
#define GRP_CDR1_VC 33
#define GRP_CDR2_VC 34
#define GRP_PLT1_VC 35
#define GRP_PLT2_VC 36
#define GRP_MFD1_VC 37
#define GRP_MFD2_VC 38
#define GRP_MFD3_VC 39
#define GRP_MFD4_VC 40
#define GRP_MFD5_VC 41
#define GRP_MFD_aft_VC 42

Then come the labels.

But might are not



Code:
#define GRP_mesh45 360
#define GRP_CDR1_VC 361
#define GRP_mesh46 362
#define GRP_CDR2_VC 363
#define GRP_mesh47 364
#define GRP_PLT1_VC 365
#define GRP_mesh48 366
#define GRP_PLT2_VC 367
#define GRP_mesh49 368
#define GRP_MFD1_VC 369
#define GRP_mesh50 370
#define GRP_MFD2_VC 371
#define GRP_mesh51 372
#define GRP_MFD3_VC 373
#define GRP_mesh52 374
#define GRP_MFD4_VC 375
#define GRP_mesh53 376
#define GRP_MFD5_VC 377
#define GRP_mesh54 378
#define GRP_MFD_AFT_VC 379

in my the label comes first. No ideas how to fix this with using notepad and move the mesh groups around?

---------- Post added 03-07-18 at 06:02 AM ---------- Previous post was 03-06-18 at 07:22 PM ----------

Fixed it. Just rearrange the groups. But got the left and right mfd to adjust the brightest. But can't get the center section to change. I am setting the vc touch arear in the right x,y area not so much about the z. I tried on the surface but it didn't work. The Atlantis looked like it was above the surface?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
So closer.

So if the ODS is present we want the eva hatch to open on the ODS not the shuttle

But I get a CTD when I try to open in.

Code:
static UINT extodsDoorGrp[2] = { 0,7};
	static MGROUP_ROTATE newextodsDoor(3, extodsDoorGrp, 2,	_V(0, -.9320414, 12.04634), _V(1, 0, 0), (float)(-120 * RAD));
	anim_extodsdoor = CreateAnimation(0);
	AddAnimationComponent(anim_extodsdoor, 0.0, 0.4632, &newextodsDoor);


The ODS is number 3 in the mesh order.

Code:
	hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\Columbia2016B");
	hOrbiterCockpitMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ColumbiaCockpit");
	hOrbiterVCMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ColumbiaVC5A");
	hOrbiterODSMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ODS");

So if I have this a ctd:
Code:
if (ODS_status = 1)SetMeshVisibilityMode(mesh_ODS, MESHVIS_ALWAYS);//ODS PRESENT SHOW MESH
	SetGearParameters (gear_proc);
	if (ODS_status==0)SetAnimation(anim_extdoor, EXT_proc);// ODS NOT PRESENT OPEN WALL HATCH
	if (ODS_status == 1)SetAnimation(anim_extodsdoor, EXT_proc);//ODS PRESENT OPEN ODS HATCH

and in the scn:
ODS 1
HATCH 1 1.0000


If i make the animation state 0.000 then no ctd
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
So now I have run into a ctd when I go to VC.

When I run the debugger i get a break at ddraw.dll
wGBzn6Y.jpg
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,681
Points
203
Location
Dallas, TX
Getting closer. I have run into this. The bright/dim.

Code:
	// handle MFD brightness buttons
	case AID_CDR1_BRT:
	case AID_CDR2_BRT:
	case AID_PLT1_BRT:
	case AID_PLT2_BRT:
	case AID_MFD1_BRT:
	case AID_MFD2_BRT:
	case AID_MFD3_BRT: 
	case AID_MFD4_BRT: 
	case AID_MFD5_BRT:
	case AID_MFDA_BRT: {
		static double t0, brt0;
		static bool up;
		int mfd = id-AID_CDR1_BRT;
		if (event & PANEL_MOUSE_LBDOWN) {
			up = (p.x >= 0.5);
			t0 = oapiGetSysTime();
			brt0 = mfdbright[mfd];
		} else if (event & PANEL_MOUSE_LBPRESSED) {
			double dt = oapiGetSysTime()-t0;
			double brt, dbrt = dt * 0.2;
			if (up) brt = min (1.0, brt0 + dbrt);
			else    brt = max (0.25, brt0 - dbrt);
			mfdbright[mfd] = brt;
			if (vis) {
				MATERIAL mat;
				memset (&mat, 0, sizeof(MATERIAL));
				mat.emissive.r = mat.emissive.g = mat.emissive.b = (float)brt;
				mat.emissive.a = 1.0f;
				DEVMESHHANDLE hMesh = GetDevMesh (vis, mesh_vc);
				oapiSetMaterial (hMesh, 17+mfd, &mat);
			}
		}
		} return false;

So as I understand it it changes the material setting.

But all that changes is the labels not the actual display
hf2DqtD.jpg
 
Top