Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Addons > Addon Requests
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Addon Requests If you have a request for a new addon or want to know where to find a specific addon, ask it here!

Reply
 
Thread Tools
Old 05-17-2018, 10:59 AM   #61
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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 is online now   Reply With Quote
Old 05-18-2018, 11:02 AM   #62
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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?
gattispilot is online now   Reply With Quote
Old 05-21-2018, 11:07 AM   #63
gattispilot
Addon Developer
 
gattispilot's Avatar
Default



Added a drag chute. Not sure when it should deploy or when it deflates.
I have it as CTRL+1 and ALT+1
Here is a link of The Columbia landing at KSC:https://drive.google.com/open?id=1EvsTF82faY
gattispilot is online now   Reply With Quote
Old 05-21-2018, 02:51 PM   #64
n122vu
Addon Developer
 
n122vu's Avatar

Default

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))
n122vu is offline   Reply With Quote
Thanked by:
Old 05-22-2018, 12:44 PM   #65
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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=1e6...66gO2VH2xMIvSO

---------- 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 by gattispilot; 05-21-2018 at 09:58 PM.
gattispilot is online now   Reply With Quote
Old 05-22-2018, 02:25 PM   #66
zerofay32
Buckeye
 
zerofay32's Avatar
Default

The drag chute was normally cut around 60 kts to keep it from hitting the Main Engine bells.
zerofay32 is offline   Reply With Quote
Thanked by:
Old 05-22-2018, 03:32 PM   #67
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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 is online now   Reply With Quote
Old 05-28-2018, 12:28 PM   #68
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So I think it is close to being finish. But I need a tester or two. I am sure I have missed something
gattispilot is online now   Reply With Quote
Old 05-30-2018, 02:41 AM   #69
Jeremyxxx
Orbinaut
Default

I'm in for the Shuttle testing. I hope.
Jeremyxxx is offline   Reply With Quote
Thanked by:
Old 05-30-2018, 10:36 AM   #70
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

This just get you the Columbia and a landing scn.
https://drive.google.com/open?id=1e6...66gO2VH2xMIvSO
If you email me: Gattispilot@yahoo.com I can sent you more
gattispilot is online now   Reply With Quote
Old 06-01-2018, 10:20 AM   #71
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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 is online now   Reply With Quote
Old 06-12-2018, 10:59 AM   #72
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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 is online now   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Addons > Addon Requests


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 09:50 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.