Idea Shuttle Fleet recompile for Orbiter 2016

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
So trying to get the payload controls to work. I had it so you press Release and it did. But couldn't reattach. SF didn't seem to do that. Not sure if SSU does.


Code:
void Atlantis::ToggleGrapple2(void)
{
	HWND hDlg;
	OBJHANDLE hV = GetAttachmentStatus(rms_attach);

	if (hV) {  // release satellite

		ATTACHMENTHANDLE hAtt = CanArrest2();
		DetachChild(rms_attach);
		if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
			//SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE), "Grapple");
			//EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
		}
		// check whether the object being ungrappled is ready to be clamped into the payload bay



#ifdef UNDEF
		VECTOR3 pos, dir, rot, gbay, gpos;
		GetAttachmentParams (sat_attach, pos, dir, rot);
		Local2Global (pos, gbay);
		VESSEL *v = oapiGetVesselInterface (hV);
		DWORD nAttach = v->AttachmentCount (true);
		for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
			ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle (true, j);
			v->GetAttachmentParams (hAtt, pos, dir, rot);
			v->Local2Global (pos, gpos);
			if (dist (gpos, gbay) < MAX_GRAPPLING_DIST) {
				AttachChild (hV, sat_attach, hAtt);
				return;
			}
		}
#endif


	}
	else {             // grapple satellite

		VECTOR3 gpos, grms, pos, dir, rot;
		//Local2Global(sat_attach2, grms);  // global position of RMS tip
		//EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), FALSE);
		// Search the complete vessel list for a grappling candidate.
		// Not very scalable ...
		for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
			OBJHANDLE hV = oapiGetVesselByIndex(i);
			if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
			oapiGetGlobalPos(hV, &gpos);
			if (dist(gpos, grms) < oapiGetSize(hV)) { // in range
				VESSEL *v = oapiGetVesselInterface(hV);
				DWORD nAttach = v->AttachmentCount(true);
				for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
					ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
					const char *id = v->GetAttachmentId(hAtt);
					//if (strncmp(id, "GS", 2)) continue; // attachment point not compatible
					v->GetAttachmentParams(hAtt, pos, dir, rot);
					v->Local2Global(pos, gpos);
					if (dist(gpos, grms) < MAX_GRAPPLING_DIST) { // found one!
						// check whether satellite is currently clamped into payload bay
						//EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), TRUE);
						if (hV == GetAttachmentStatus(sat_attach))
							DetachChild(sat_attach2);
						AttachChild(hV, sat_attach2, hAtt);
						if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
						//	SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE), "Release");
						//	EnableWindow(GetDlgItem(hDlg, IDC_STOW), FALSE);
						}
						return;
					}
				}
			}
		}

	}
}
void Atlantis::ToggleArrest2(void)
{


	HWND hDlg;

	if (CanArrest2()) {           // try to arrest satellite
		ToggleGrapple2();

	}

}




// check whether the currently grappled object can be stowed in the cargo bay
ATTACHMENTHANDLE Atlantis::CanArrest2(void) const
{
	OBJHANDLE hV = GetAttachmentStatus(sat_attach2);
	if (!hV) return 0;
	VESSEL *v = oapiGetVesselInterface(hV);
	DWORD nAttach = v->AttachmentCount(true);
	VECTOR3 pos, dir, rot, gpos, gbay;
	//GetAttachmentParams(sat_attach, pos, dir, rot);
	Local2Global(pos, gbay);
	for (DWORD j = 0; j < nAttach; j++) {
		ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
	//	if (strncmp(v->GetAttachmentId(hAtt), "XS", 2)) continue; // attachment point not compatible
		v->GetAttachmentParams(hAtt, pos, dir, rot);
		v->Local2Global(pos, gpos);
		if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
			return hAtt;
		}
	}
	return 0;
}

So as I see it it checks to see if an attachment is close to attach_sat2 if it is detach or attach depending on the state.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
So I got it to grap/release where payload2 is. In the test the Ultra_OBSS is the target. So it only attaches the OBSS I have it set to grap any thing with a id of OS. Else it graps the mlpms:(

Any thoughts?
 

n122vu

Addon Developer
Addon Developer
Donator
Joined
Nov 1, 2007
Messages
3,173
Reaction score
13
Points
63
Location
KHNB
Not to be nit-picky, but rather, to avoid code issues for you in the future, you might check your spelling of "ORIGINAL" here:
Code:
sscanf(line + 7, "%d", &ORGINIAL);

It's different than here:
Code:
if (!_strnicmp(line, "ORGINAL", 7))
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
Thanks. Yes. I think I have it correct in the current code.
Code:
if (!_strnicmp(line, "ORIGINAL", 7))
			{
				sscanf(line + 7, "%d", &ORIGINAL);
				ORIGINAL = 1;
			}

Code:
if (ORIGINAL == 1) oapiWriteScenario_string(scn, "ORIGINAL", " ");

and a new zip:https://drive.google.com/open?id=1e6w2aEWngq8LGaPiQr66gO2VH2xMIvSO

---------- Post added 05-22-18 at 07:44 AM ---------- Previous post was 05-21-18 at 10:44 AM ----------

So I assume the drag chute opens when touchdown of the gear occurs? But how to code that? And then if zero forward speed then release, right?
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
Thanks. So I guess then like if forward speed<60kts then release chute. Which is make drag chute not seen and make a chute vessel that is left behind on the runway?

Not sure if the chute would need to be scaled down to be flat or just show a flat chute.

But how to tell the chute to deploy? Not sure how to do something if landed?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
So I think it is close to being finish. But I need a tester or two. I am sure I have missed something
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
So there were some thing I have added on. Like a speed Brake that it Not either open or close but now is adjustable also.

As stated because the code is not available so it has to be redone.

We chose ms2015 so we could change meshes,...easily. But you can't just add a shuttle with et, srb,....

Since I am the really the only guy coding it now. I could use the help.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
So trying to modify the speed brake.

But not sure what the scale function does?
trying to get a line to move according to speed brake proc. I know Sf has a diamond. But not sure how to draw a diamond
Code:
// draw the default HUD
	VESSEL4::clbkDrawHUD (mode, hps, skp);
	int cx = hps->CX, cy = hps->CY;

	// show OMS thrust marker
	if (status >= 3) {
		int omsy = cy + (int)(15.0*hps->Scale);
		int dx = (int)(1.0*hps->Scale);
		skp->Line (cx-2*dx, omsy, cx+2*dx, omsy);
		skp->Line (cx, omsy-dx, cx, omsy+dx);
	}
	int d = hps->Markersize / 2;
	int spbrkx = (spdb_proc)*-5;

	if (spdb_proc == 0)spbrkx = 5;
	if (spdb_proc == 1)spbrkx = -5;
	if (spdb_proc == .5)spbrkx = 0;
	if (spdb_proc == .25)spbrkx = 2.5;
	if (spdb_proc == .75)spbrkx = -2.5;
	skp->Rectangle(cx - d * -5, cy + d * 22, cx - d*-4, cy + d * 23);

	skp->Rectangle(cx - d * -4, cy + d * 22, cx - d*-3, cy + d * 23);
	skp->Rectangle(cx - d * -3, cy + d * 22, cx - d*-2, cy + d * 23);

	skp->Rectangle(cx - d * -2, cy + d * 22, cx - d*-1, cy + d * 23);

	skp->Rectangle(cx - d * -1, cy + d * 22, cx - 0 , cy + d * 23);
	skp->Rectangle(cx - d * 0, cy + d * 22, cx - d, cy + d * 23);

	skp->Rectangle(cx - d * 3, cy + d * 22, cx - d * 2, cy + d * 23);
	skp->Rectangle(cx - d * 2, cy + d * 22, cx - d*1 , cy + d * 23);
	skp->Rectangle(cx - d * 4, cy + d * 22, cx - d *3, cy + d * 23);
	skp->Rectangle(cx - d * 5, cy + d * 22, cx - d * 4, cy + d * 23);

	skp->Line(cx - d*spbrkx, cy + d * 21, cx - d*spbrkx * 1, cy + d * 22);
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
So I have redone all the shuttle meshes. Working on the ODS. It will not be as detailed as the SSU one. But the Docking ring will extend out.

What seems odd is the dock of the shuttle has 3 fins while ISS has 4?
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,634
Reaction score
25
Points
63
Code:
if (!_strnicmp(line, "ORIGINAL", 7))
			{
				sscanf(line + 7, "%d", &ORIGINAL);
				ORIGINAL = 1;
			}

Just saw it, I think the sscanf line is without any use. I suggest to use the ccorect variables types, so if ORIGINAL is only 1 and 0 use a boolean, and if it is found it's not necessary to sscanf for it, just put ORIGINAL = true and go on.
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
86
Points
123
Location
Cape
So I have redone all the shuttle meshes. Working on the ODS. It will not be as detailed as the SSU one. But the Docking ring will extend out.

What seems odd is the dock of the shuttle has 3 fins while ISS has 4?
Not the ISS A2Z.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
Thanks. I guess I am using the default ISS.

---------- Post added 08-16-18 at 06:00 AM ---------- Previous post was 08-15-18 at 09:45 AM ----------

So got the ring to extend.


But haven't got the dock to follow animations yet.
Code:
	if (ODS == 1){//ODS is  present
		if (DOCKRING_status >= HATCH_RAISING) {
			double da = simdt * .1;
			if (DOCKRING_status == HATCH_RAISING) {
				if (DOCKRING_proc > 0.0) DOCKRING_proc = max(0.0, DOCKRING_proc - da);
				else DOCKRING_status = HATCH_UP;
			}
			else {
				if (DOCKRING_proc < 1.0) DOCKRING_proc = min(1.0, DOCKRING_proc + da);
				else DOCKRING_status = HATCH_DOWN;
			}
			SetAnimation(anim_DOCKRING, DOCKRING_proc);
			dockpos.y = dockpos.y + (DOCKRING_proc * .45);  //move dock post on y axis  to follow ring position  rign move up.45 when extended

			SetDockParams(dockpos, _V(0, 1, 0), _V(0, 0, -1));

		}
	}

Also the ring animation seems to not work in d3d9?
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
86
Points
123
Location
Cape
I don't think the SSU has the docking follow the animation either.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
So I guess the dock can not be moved with the animation:(

The dock pos moves as I can undock and the shuttle will dock at the ring extended point. But when I retract the ring the dock doesn't move?



Code:
hDockODS = CreateDock(ORBITER_DOCKPOS, _V(0, 1, 0), _V(0, 0, -1));  //dock for ods



Code:
void Atlantis::SetODSDock(void) {
	SetDockParams(hDockODS, dockpos, _V(0, 1, 0), _V(0, 0, -1));

}

Code:
if (ODS == 1){//ODS is  present
		//SetDockParams(dockpos, _V(0, 1, 0), _V(0, 0, -1));
		if (DOCKRING_status >= HATCH_RAISING) {
			double da = simdt * .1;
			if (DOCKRING_status == HATCH_RAISING) {
				if (DOCKRING_proc > 0.0) DOCKRING_proc = max(0.0, DOCKRING_proc - da);
				else DOCKRING_status = HATCH_UP;
			}
			else {
				if (DOCKRING_proc < 1.0) DOCKRING_proc = min(1.0, DOCKRING_proc + da);
				else DOCKRING_status = HATCH_DOWN;
			}
			SetAnimation(anim_DOCKRING, DOCKRING_proc);
			dockpos.y = 2.40 + (DOCKRING_proc * .45);  //move dock post on y axis  to follow ring position  rign move up.45 when extended

			//SetDockParams(dockpos, _V(0, 1, 0), _V(0, 0, -1));
				//sprintf(oapiDebugString(), "%0.4f ", dockpos.y);
			SetODSDock();
		}
	}
 
Last edited:

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
86
Points
123
Location
Cape
Probably have to have the docking ring a separate vessel.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
6,135
Reaction score
542
Points
188
Location
Dallas, TX
Oh. Then. I guess attach the ring to shuttle. Then have the attachment move.

---------- Post added 08-17-18 at 08:36 AM ---------- Previous post was 08-16-18 at 07:07 PM ----------

So I made the ring a separate vessel with just a dock and attachment.
Code:
; === Configuration file for vessel class ===

ClassName = dockingring
MeshName = 2016SPACESHUTTLE\\Dockring


Mass = 1
Size = 2

BEGIN_DOCKLIST
 0 2.25 10.141    0 1 0   0 0 -1
END_DOCKLIST

BEGIN_ATTACHMENT
P 0  2.259  10.141   0 -1 0  0 0 1  Ring
END_ATTACHMENT

Made an attachment point that matches the ring. And it moves.
But it isn't docking correctly

Code:
Dockring:Dockingring
  STATUS Orbiting Earth
  RPOS 216496.775 -6499572.636 1795366.987
  RVEL -7541.7540 143.7407 1442.3599
  AROT -75.171 -11.705 -81.200
  VROT 0.3995 -0.0070 -0.0041
  ATTACHED 0:8,Constellation
  AFCMODE 7
  DOCKINFO 0:1,ISS
  NAVFREQ 0 0
END

 
Top