Idea Shuttle Fleet recompile for Orbiter 2016

This is what I have for Guidance for sts2
Code:
-30.000 =orbit(222,21,38.03,-1)
-6.0 =engine(0,100,6)
3.0 =engine(100,104.5,1.00)
30.0 =engine(104.5,72.00,5.00)
55.0 =engine(72.0,104.5,5.00)
120.0 =jettison()
121.0 =glimit(3.0)
200.0 =glimit(3.0)
225.0 =inverse()
300.0 =glimit(3.0)
400.0 =glimit(3.0)
500.0 =glimit(3.0)

Try change the orbit to:
-30.000 =orbit(222,231,38.03,-1)
 
This is what I have for Guidance for sts2
Code:
-30.000 =orbit(222,21,38.03,-1)
-6.0 =engine(0,100,6)
3.0 =engine(100,104.5,1.00)
30.0 =engine(104.5,72.00,5.00)
55.0 =engine(72.0,104.5,5.00)
120.0 =jettison()
121.0 =glimit(3.0)
200.0 =glimit(3.0)
225.0 =inverse()
300.0 =glimit(3.0)
400.0 =glimit(3.0)
500.0 =glimit(3.0)

Try change the orbit to:
-30.000 =orbit(222,231,38.03,-1)

You can't set the engines to 104.5% of power.

As far as I know the 104.5% arrived when the engines were given the ok to be "overclocked" a bit and in order not to rescale everything they simply made the calls up to 104. But in orbiter maximum is always 100% of course...
 
LyjFon3.jpg

orbit for STS2

The other thing I am working on for this will be the launch of satellites. Looking at the SF sat launch. The ase and IUS were tilted using attachment 0,4. I can tilt back but for some reason I expect the IUS to fly away?

---------- Post added 11-24-18 at 05:18 AM ---------- Previous post was 11-23-18 at 05:37 PM ----------

So working on tilting attachment points and saving/loading them.
I have the change the points in the scn and save them. But the tilt ones are not getting loaded.
Code:
//tilt of ase/IUS
if (tilt == 1)		ANGULAR_VEL = ANGULAR_VEL+.0001;//move up
if (tilt == 2)		ANGULAR_VEL = ANGULAR_VEL - .0001;//move down
if ((tilt == 1) && (phi > tiltvalue))tilt = 0;  //reaches limit so stop
if ((tilt == 2) && (phi < tiltvalue))tilt = 0;  //reaches limit so stop
if (phi < 0)phi = 0;
xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
if ((tilt == 1) || (tilt == 2))phi = ANGULAR_VEL * simt;
DIR = _V(0, sin(phi), cos(phi));
//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
//SetAttachmentParams(sat_attach1, pl1_ofs, DIR, pl1_rot);//ius
//sets new attachment rotation values for saving
pl1_dir.x = DIR.x;
pl4_dir.x = DIR.x;
pl1_dir.y = DIR.y;
pl4_dir.y = DIR.y;
pl1_dir.z = DIR.z;
pl4_dir.z = DIR.z;
;
keys just set the end tilt value:
Code:
if (key == OAPI_KEY_4){
		if (tiltvalue ==0){
			tilt = 1;
			tiltvalue=.5;
			
		}
		
		else if (tiltvalue == .5){
			tilt = 1;
			tiltvalue = .9;
		}
		return 1;
	}
	if (key == OAPI_KEY_5){
		
			tilt = 2;
			tiltvalue = 0;
		
		return 1;
	}
	if (key == OAPI_KEY_6){

		DetachChild(sat_attach1, 5.0);

		return 1;
	}

scn: rot values are saved:
Code:
PL1_OFS 0.0000 -0.5000 -7.5000
  PL1_DIR 1.0000 0.0000 0.0000
  PL1_ROT 0.0000 0.4963 0.8681
  PL2_OFS -0.0500 -0.2000 -3.6000
  PL2_DIR 0.0000 1.0000 0.0000
  PL2_ROT 0.0000 0.0000 1.0000
  PL3_OFS 0.0000 0.0000 -5.5000
  PL3_DIR 0.0000 0.0000 1.0000
  PL3_ROT 1.0000 0.0000 0.0000
  PL4_OFS 0.0000 0.5000 -7.5000
  PL4_DIR 1.0000 0.0000 0.0000
  PL4_ROT 0.0000 0.4963 0.8681




arm1_tip is set to saved attachment values.
Code:
arm1_tip[0] = pl4_ofs;
	arm1_tip[1] = pl4_dir;
	arm1_tip[2] = pl4_rot;

SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, pl1_rot);//0
SetAttachmentParams(sat_attach2, pl2_ofs, pl2_dir, pl2_rot);//1
SetAttachmentParams(sat_attach3, pl3_ofs, pl3_dir, pl3_rot);//2
SetAttachmentParams(sat_attach4, pl4_ofs, pl4_dir, pl4_rot);//3
But the ase/ius is not tilted when loaded?
the IUS is attached at the sat_attach1 attachment point when I press 6 to detach the child nothing happens


If I comment out the set attachment it loads the saved value but I can't move it

---------- Post added at 01:10 PM ---------- Previous post was at 05:18 AM ----------

Attachments created:
Code:
sat_attach1 = CreateAttachment(false, pl1_ofs, pl1_dir, pl1_rot, "X");//0
	sat_attach2 = CreateAttachment(false, pl2_ofs, pl2_dir, pl2_rot, "0");//1
	sat_attach3 = CreateAttachment(false, pl3_ofs, pl3_dir, pl3_rot, "X");//2
	sat_attach4 = CreateAttachment(false, pl4_ofs, pl4_dir, pl4_rot, "C");//3
	sat_attach5 = CreateAttachment(false, pl5_ofs, pl5_dir, pl5_rot, "D");//4
	sat_attach6 = CreateAttachment(false, pl6_ofs, pl6_dir, pl6_rot, "E");//5
	sat_attach7 = CreateAttachment(false, pl7_ofs, pl7_dir, pl7_rot, "F");//6


I got the attachment to rotate and save.
Code:
	if (tilt == 1)tiltvalue = .5;
	if (tilt == 3)tiltvalue = 1.2;
	if (tilt == 4)		ANGULAR_VEL = ANGULAR_VEL + .0001;//move up
if (tilt == 1)		ANGULAR_VEL = ANGULAR_VEL+.0001;//move up
if (tilt == 2)		ANGULAR_VEL = ANGULAR_VEL - .0001;//move down
if ((tilt == 1) && (phi > tiltvalue))tilt = 3;  //reaches limit so stop
if ((tilt == 4) && (phi > tiltvalue))tilt = 0;  //reaches limit so stop
if ((tilt == 2) && (phi < 0))tilt = 0;  //reaches limit so stop
if (phi < 0)phi = 0;
xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
if ((tilt == 1) || (tilt == 2) || (tilt == 4))phi = ANGULAR_VEL * simt;
DIR = _V(0, sin(phi), cos(phi));

SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
SetAttachmentParams(sat_attach1, pl1_ofs, DIR, pl1_rot);//ius
//sets new attachment rotation values for saving
pl1_dir.x = DIR.x;
pl4_dir.x = DIR.x;
pl1_dir.y = DIR.y;
pl4_dir.y = DIR.y;
pl1_dir.z = DIR.z;
pl4_dir.z = DIR.z;

But can not detach from the point.
Code:
if (key == OAPI_KEY_6){

		DetachChild(sat_attach4, 5.0);
		DetachChild(sat_attach2, 5.0);
		DetachChild(sat_attach1, 5.0);
		DetachChild(sat_attach3, 5.0);
		DetachChild(sat_attach5, 5.0);
		DetachChild(sat_attach6, 5.0);
		return 1;
	}


---------- Post added 11-25-18 at 05:55 AM ---------- Previous post was 11-24-18 at 01:10 PM ----------

So I am able to tilt the 2 attachments points. in SF attachment 4 was for the ASE and 0 for the IUS.

Code:
PL1_OFS 0.000000 0.150000 -1.400000
  PL1_DIR 0.000000 0.000000 1.000000
  PL1_ROT 1.000000 0.000000 0.000000
PL4_OFS 0.000000 0.700000 -1.400000
PL4_DIR 0.000000 0.000000 1.000000
  PL4_ROT 1.000000 0.000000 0.000000
notice the difference in ofs of 0 and 4 What that does it set the IUS better into the ase. But when full tilted the IUS moves back and up.
81xFvAf.jpg

ohgSxvV.jpg


So One mine I am setting them both so when tilted back it should remain the same.

So the issue becomes the IUS attachment points.
Code:
P 0 0 0  0 0 -1  0 1 0 XS

and the ASE/shuttle
Code:
 PL1_OFS 0.0000 0.50000 -7.500
  PL1_DIR 0.0000 0.0000 1.0000
  PL1_ROT 1.0000 0.0000 0.0000

So what should the attachment be in the IUS?
The bigger issue is the launch/detach of the IUS. I have dettach child for all attachments and nothing is happening


So the IUS attachment need to be like this:
P -.1 .75 -3.4 0 0 -1 1 0 0 XS
 
Last edited:
So working on a spintable.

I can get the attachment to spin but when I detach the child it jumps high.
Code:
	if (SPIN1 == 1){
		

		
		if ((spintable == 1)&& (rotchange <=.30))rotchange = rotchange + .001;//OPERATE SPINTABLE
			ANGULAR_VEL = 2 * PI * (rotchange);
		
		

		sprintf(oapiDebugString(), " phi %d tilt %f spintable %f", spintable, ANGULAR_VEL, rotchange);
		if (phi < 0)phi = 0;
		//if (phi >1.2)phi = 1.2;
		xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
		xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
		if (spintable == 1) phi = ANGULAR_VEL *simt;  //move ase attachment and ius
		ROT = _V(sin(phi),0, cos(phi));

		//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
		SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//ius
		//sets new attachment rotation values for saving
		pl1_rot.x = ROT.x;
		//pl4_dir.x = DIR.x;
		pl1_rot.y = ROT.y;
		//pl4_dir.y = DIR.y;
		pl1_rot.z = ROT.z;
		//pl4_dir.z = DIR.z;
		if ((spintable == 2) && (rotchange >= .30))DetachChild(sat_attach1, 0);
	}


---------- Post added at 03:59 PM ---------- Previous post was at 10:20 AM ----------

It now detaches good. But not sure how to get the Satellite that was attached to spin once released
 
It now detaches good. But not sure how to get the Satellite that was attached to spin once released

You need to play with the vesselstatus2 vrot.

Now, I can't say for sure if it's enough, but it seems to me that if you just add your desidred velocity to vrot.z you'll get what you need. Again, it may be that you have to rotate it with the rotation matrix against the ecliptic frame, I can't remember now by hand, but it seems to me that for this it was not needed, you just add your velocity and that's it.
 
Thanks. But that would be needed to change to the PAM right? PAM is the vessel attached to the point.

Code:
PAM-1:STS_PAYLOADS\PAM
  STATUS Orbiting Earth
  RPOS 2877820.567 5685925.276 -2166428.191
  RVEL 6813.8991 -3571.2389 -321.0302
  AROT -172.857 -80.136 -157.610
  ATTACHED 0:0,VENTURESTAR
  AFCMODE 7
  PRPLEVEL 0:1.000000
  NAVFREQ 0 0
END
STAR-48B1:STS_PAYLOADS\EQUIP
  STATUS Orbiting Earth
  RPOS 2877820.567 5685925.276 -2166428.191
  RVEL 6813.8991 -3571.2389 -321.0302
  AROT -172.857 -80.136 -157.610
  ATTACHED 0:0,PAM-1
  AFCMODE 7
END

And it has no mesh
Code:
; === Configuration file for vessel class STS-PAM ===
ClassName = PAM
Mass = 236 ;124KG EMPTY STAR-48B SHORT: MASS 102KG EQUIPMENT MASS
PropellantResource1 = 2000 ;STS LOAD FUEL
Size = 10
MaxAttitudeThrust = 0
ISP = 2802
MaxMainThrust = 67170
TouchdownPoints = 0 -0.882 -2.027 -.882 .882 -2.027 .882 .882 -2.027
CrossSections = 1.77 1.80 1.37
Inertia = 0.22 0.22 0.22
MEngineRef1 = 0 0 -1.5
CameraOffset = 0 1.2 -0.15





; === Attachment specs ===
BEGIN_ATTACHMENT
C 0 0 0  0 0 1  0 1 0 XS ;TO STAR-48B
P 0 0 0  0 0 -1  0 1 0 XS ;TO SPIN TABLE
END_ATTACHMENT

Code:
; === Configuration file for vessel class Satellite ===
ClassName = EQUIP
MeshName = sts_payloads\pam-d
Mass = 1124
Size = 10
PropellantResource1 = 10
MaxAttitudeThrust = 1
MaxMainThrust = 1
AttRefZ00 =  0.65 0 -0.2
AttRefZ01 =  -0.65 0 -0.2
ISP = 10000
EnableFocus = FALSE



; === Attachment specs ===
BEGIN_ATTACHMENT
P 0 0 0  0 0 -1  0 1 0 XS ; TO PAM-D
C 0 0 0  0 0 1  0 1 0 XS  ; TO SATELLITE
END_ATTACHMENT


Once this rot gets to 50 rpm it stops increasing. Not sure to figure the 50 rpm?

---------- Post added at 03:07 PM ---------- Previous post was at 04:41 AM ----------

So not sure how to tell when 50 rpm occurs?

But on the add force to attached vessel? Not sure about that?
I suspect something like get the handle of attachment and then add force to such ship?
 
So on the IUS. I know it should rotate to 29 and 58 degrees.
So I increase this value
Code:
if (tilt == 1)		ANGULAR_VEL = ANGULAR_VEL + .001;//move up
Then times simt rate:
Code:
phi = ANGULAR_VEL *simt

So then set the direction vector for attachment:
Code:
DIR = _V(0, sin(phi), cos(phi));


But shouldn't phi be like degrees?

---------- Post added at 07:24 PM ---------- Previous post was at 03:13 PM ----------

So spintable
Code:
if (SPIN1 == 1){
		

		
		if ((spintable == 1)  && (rotchange <= .30))rotchange = rotchange + .001;//OPERATE SPINTABLE
			ANGULAR_VEL = 2 * PI * (rotchange);
		
		

		//sprintf(oapiDebugString(), " phi %d tilt %f spintable %f", spintable, ANGULAR_VEL, rotchange);
		if (phi < 0)phi = 0;
		//if (phi >1.2)phi = 1.2;
		xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
		xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
		if ((spintable == 1) || (spintable==3)) phi = ANGULAR_VEL *simt;  //move ase attachment and ius
		ROT = _V(sin(phi),0, cos(phi));
		if ((spintable == 1) && (rotchange >= .30)) spintable = 3;
		//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
		SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//ius
		//sets new attachment rotation values for saving
		pl1_rot.x = ROT.x;
		//pl4_dir.x = DIR.x;
		pl1_rot.y = ROT.y;
		//pl4_dir.y = DIR.y;
		pl1_rot.z = ROT.z;
		//pl4_dir.z = DIR.z;
		
	}

it does spin. But once released the vessel doesn't spin.

And mot sure if the stop of .3 is equal to 50 rpm?
 
So I am needing to add rotation to an attached vessel
Code:
	{  
		hVessel = GetAttachmentHandle(true, 1);
		VESSEL *v = oapiGetVesselInterface(hVessel);
		VESSELSTATUS2 vs;
		memset(&vs, 0, sizeof(vs));
		vs.version = 2;
		v->GetStatusEx(&vs);
		//   v->vs.vrot.z = PI / 2 + vs.vrot.z;
		v->SetAngularVel(_V(0, 0, 1.7));
		v->DefSetStateEx(&vs);
	}

I get a CTD now
Code:
PAM-1:STS_PAYLOADS\PAM
  STATUS Orbiting Earth
  RPOS 2877820.567 5685925.276 -2166428.191
  RVEL 6813.8991 -3571.2389 -321.0302
  AROT -172.857 -80.136 -157.610
  ATTACHED 0:0,VENTURESTAR
  AFCMODE 7
  PRPLEVEL 0:1.000000
  NAVFREQ 0 0
END
 
So looking at the sdk

17.57.3.90 ATTACHMENTHANDLE VESSEL::GetAttachmentHandle ( bool toparent, DWORD i ) const
Return the handle of an attachment point identified by its list index.
Parameters
toparent If true, return a handle for an attachment point to a parent. Otherwise, return a handle for an
attachment point to a child.
i attachment index (>= 0)


Code:
hVessel = GetAttachmentHandle(true, 1);

So this should return the handle of the vessel attached to the parent of attachment #1, right


no ctd but if I add this
VESSEL *v = oapiGetVesselInterface(hVessel);

I get a CTD

---------- Post added 12-09-18 at 06:27 AM ---------- Previous post was 12-08-18 at 07:08 AM ----------

So not sure why I get a CTD:
Code:
		hVessel = GetAttachmentHandle(true, 1);
		VESSEL *v = oapiGetVesselInterface(hVessel);

Maybe hVessel is bad:
Code:
OBJHANDLE hVessel;
 
Last edited:
So looking at the sdk

17.57.3.90 ATTACHMENTHANDLE VESSEL::GetAttachmentHandle ( bool toparent, DWORD i ) const
Return the handle of an attachment point identified by its list index.
Parameters
toparent If true, return a handle for an attachment point to a parent. Otherwise, return a handle for an
attachment point to a child.
i attachment index (>= 0)


Code:
hVessel = GetAttachmentHandle(true, 1);
[/code]

GetAttachmentHandle, as per the API reference documentation you just posted, returns an ATTACHMENTHANDLE, not an object handle OBJHANDLE.

GetAttachmentStatus method returns the OBJHANDLE of the attached vessel given an ATTACHMENTHANDLE.

Finally, you can use oapiIsVessel API method to check for valid vessel OBJHANDLE.
 
Thanks.
So I have this no ctd. But I suppose the rot movement should be applied when dettached?
Code:
hVessel = GetAttachmentStatus(sat_attach1);

		VESSEL *v = oapiGetVesselInterface(hVessel);
		VESSELSTATUS2 vs;
		memset(&vs, 0, sizeof(vs));
		vs.version = 2;
		v->GetStatusEx(&vs);
		//   v->vs.vrot.z = PI / 2 + vs.vrot.z;
		v->SetAngularVel(_V(0, 0, 1.7));
		v->DefSetStateEx(&vs);


---------- Post added at 05:02 PM ---------- Previous post was at 04:57 PM ----------

So I tried this and CTD when released:
Code:
{  //  sat releashed so apply rotation
			//17.57.3.94 OBJHANDLE VESSEL::GetAttachmentStatus(ATTACHMENTHANDLE attachment) const
			//Return the current status of an attachment point.
			hVessel = GetAttachmentStatus(sat_attach1);

			VESSEL *v = oapiGetVesselInterface(hVessel);

			if (!GetAttachmentStatus(sat_attach1)){
				VESSELSTATUS2 vs;
				memset(&vs, 0, sizeof(vs));
				vs.version = 2;
				v->GetStatusEx(&vs);
				//   v->vs.vrot.z = PI / 2 + vs.vrot.z;
				v->SetAngularVel(_V(0, 0, 1.7));
				v->DefSetStateEx(&vs);
			}}
	}
 
Is hVessel valid? Call oapiIsVessel(hVessel) and do you get true? I suspect when you call GetAttachmentStatus you are either passing an invalid attachment handle or there is nothing attached to that attachment.
 
Thanks. Not sure what you mean

I ran the debug and got:
hVessel 0x1e6ca738 void *

So I think I need to get the handle of the attached vessel and then do stuff when released
 
Some of your code doesn't make sense. GetAttachmentStatus doesn't return a bool, not sure why you are calling it twice. Take a look at this project to get a better understanding of attachments: https://github.com/computerex/orbiter-plugins/tree/master/autoattach/orbitersdk/samples/AutoAttach

Assuming this is for child attachments (invert the toparent bool otherwise)

Code:
for(int i = 0; i < AttachmentCount(false); i++) 
{
      ATTACHMENTHANDLE ah = GetAttachmentHandle(false, i);
      OBJHANDLE hChild = GetAttachmentStatus(ah);
      if (oapiIsVessel(hChild)) { // something is attached!
           DetachChild(ah, 5); // m/s release speed
           // NOW you can use DefSetState on hChild to add the angular velocity
      }
}

I think you might be looking for something like that.
 
Thanks. But for this only looking at 1 attachment satattach1 which is number 1
so maybe this:
Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 1);
			OBJHANDLE hChild = GetAttachmentStatus(ah);

Then I have a key to detach. Not if nothing attached apply rot to child vessel
 
Attachment indexes I think start at 0, not 1:

17.57.3.92 DWORDVESSEL::GetAttachmentIndex( ATTACHMENTHANDLEattachment )const
Return the list index of the vessel's attachment point defined by its handle.
Generated on Wed Aug 24 2016 00:01:08 for Orbiter API by Doxygen
17.57 VESSEL Class Reference 457
Parameters attachment attachment handle
Returns List index (>= 0)
 
Ok. So not sure how to add rot to the child once detached

Code:
17.57.3.261 voidVESSEL::SetAngularVel( constVECTOR3&avel )const
Applies new angular velocity to the vessel.
Generated on Wed Aug 24 2016 00:01:08 for Orbiter API by Doxygen
518 CONTENTS
Parameters
avel vector containing the new angular velocity components [rad/s]
Note
The input vector defines the angular velocities around the vessel's x, y and z axes. They refer to the rotating vessel frame.


---------- Post added at 12:04 AM ---------- Previous post was at 12:04 AM ----------

Look at the scenario editor for example.

Code:
void EditorTab_Orientation::ApplyAngularVel ()
{
	int i;
	char cbuf[256];
	VESSEL *vessel = oapiGetVesselInterface (ed->hVessel);
	VECTOR3 avel;
	for (i = 0; i < 3; i++) {
		GetWindowText (GetDlgItem (hTab, IDC_EDIT4+i), cbuf, 256);
		sscanf (cbuf, "%lf", &avel.data[i]);
		avel.data[i] *= RAD;
	}
	vessel->SetAngularVel (avel);
}
 
Last edited:
Thanks
Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
			OBJHANDLE hChild = GetAttachmentStatus(ah);
			//if (oapiIsVessel(hChild)) { // something is attached!
			//	DetachChild(ah, 5); // m/s release speed
				// NOW you can use DefSetState on hChild to add the angular velocity
			if (GetAttachmentStatus(sat_attach1)) satattach = 1;
			if ((!GetAttachmentStatus(sat_attach1))&&(satattach==1)){//sat was attached but now it isn't
				VESSEL *vessel = oapiGetVesselInterface(hChild);
				VECTOR3 avel;
				vessel->SetAngularVel(_V(0, 0, 1.7));
				satattach = 0;
			}
			
	}

Get a CTD on release.
 
Thanks
Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
			OBJHANDLE hChild = GetAttachmentStatus(ah);
			//if (oapiIsVessel(hChild)) { // something is attached!
			//	DetachChild(ah, 5); // m/s release speed
				// NOW you can use DefSetState on hChild to add the angular velocity
			if (GetAttachmentStatus(sat_attach1)) satattach = 1;
			if ((!GetAttachmentStatus(sat_attach1))&&(satattach==1)){//sat was attached but now it isn't
				VESSEL *vessel = oapiGetVesselInterface(hChild);
				VECTOR3 avel;
				vessel->SetAngularVel(_V(0, 0, 1.7));
				satattach = 0;
			}
			
	}

Get a CTD on release.

This doesn't look right. Under no circumstances should a CTD occur. This is why these lines should not be removed:

Code:
//if (oapiIsVessel(hChild)) { // something is attached!
			//	DetachChild(ah, 5); // m/s release speed

And you cannot use GetAttachmentStatus like you are using. What is the output of the debug string when you run this code?

Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
OBJHANDLE hChild = GetAttachmentStatus(ah);
if (oapiIsVessel(hChild)) { // something is attached!
    sprintf(oapiDebugString(), "%s is attached", oapiGetVesselInterface()->GetName());
} else sprintf(oapiDebugString(), "nothing is attached");

Given the code you have posted here the most likely lines causing the CTD is

Code:
VESSEL *vessel = oapiGetVesselInterface(hChild);

Where hChild is not valid and so vessel is not a valid pointer and then calling any methods on it will result in CTD. This is why sanity checks are necessary so you can understand what's going on. CTD's shouldn't happen as a general rule of thumb.
 
Last edited:
Back
Top