if (USEIUS == 1){
//tilt of ase/IUS
if (tilt == 1)tiltvalue = .6; //first step
if (tilt == 3)tiltvalue = 1.0; //2nd step
//phi = phi + .001;//move up second step
if (tilt == 1) phi = (phi + .001);//move up
if (tilt == 2) phi = (phi - .001);//move down
if (tilt == 4) phi = (phi + .001);//move down
if ((tilt == 1) && (phi > tiltvalue))tilt = 3; //reaches limit so 1st stop
if ((tilt == 4) && (phi > tiltvalue))tilt = 0; //reaches limit so 2nd stop
if ((tilt == 2) && (phi < 0))tilt = 0; //reaches limit so stop
if (phi < 0)phi = 0;
if (phi >1.0)phi = 1.0;
//phi = 1;
xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
//if ((tilt == 1) || (tilt == 4) || (tilt == 2))phi = phi *simt; //move ase attachment and ius
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;
}
if (SPIN1 == 1){//spintable#1
if ((spintable == 1) && (rotchange <= .50))rotchange = rotchange + .001;//OPERATE SPINTABLE and if rate change is less than .3 do not increase
ANGULAR_VEL = 2 * PI * (rotchange);//apply rot to ang vel
//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 >= .50)) spintable = 3; // up to speed
//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//satellite
//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;
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
OBJHANDLE hChild = GetAttachmentStatus(ah);
if (oapiIsVessel(hChild)) { // something is attached!
VESSEL *v = oapiGetVesselInterface(hChild);
// sprintf(oapiDebugString(), "%s is attached",
// v->GetName());
}
//else sprintf(oapiDebugString(), "nothing is attached");
//else sprintf(oapiDebugString(), "nothing is attached");
}