See site in english Voir le site en francais
Website skin:
home  download  forum  link  contact

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Author Topic: [tutorial] Programming UMMU with more than one dock  (Read 4140 times)

0 Members and 1 Guest are viewing this topic.

Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15407
  • Karma: 256
  • Hein, quoi !?
    • FsPassengers
10 September 2007, 14:09:13
Programming UMMU in your addon when you have more than one dock is easy, you just need to allow the user
to select wich dock is active for EVA and transfert and define the position of the UMMU and airlock shape when EVA. Optionnaly if you have a station you can at this occasion change also the position of the camera so it work as an external cam that would show the dock. See example how it work with the ISS compatible UMMU here:
http://orbiter.dansteph.com/index.php?disp=dgIVMore&DId=31

Features:

-User can select wich dock is active for EVA, ingress and transfert
-UMMU will appear in front of the active dock
-UMMU can ingress the ship using the active dock (ie: go in front of it and press key "E")
-UMMU will be transfered from/to compatible addon docked to the active dock

Optionnal:
Camera will show and outside view ot the active dock (see UMMU ISS above)


UMMU fonction used

SetActiveDockForTransfer()
DefineAirLockShape()

Optionnal fonction for camera:

SetCameraOffset();
SetCameraDefaultDirection();


walktrought

First declare a new variable in your header that will contain the current active dock:

Code: [Select]
int iActiveDockNumber;
Then create a new function that will set the position of the UMMU when EVA and the shape of "virtual box" around it
that will be taken in account when user want to ingress. It's the good location to also redefine position of your
camera if you want this feature:

Code: [Select]
///////////////////////////////////////////////////////////////////////////////////////////
// SetUMMUAirlockPos - example with two dock
///////////////////////////////////////////////////////////////////////////////////////////

void MyAddon::SetUMMUAirlockPos(void)
{

int AirlockStatus=Crew.GetAirlockDoorState();
Crew.SetActiveDockForTransfer(iActiveDockNumber);

switch(iActiveDockNumber)
{
case 0:

Crew.DefineAirLockShape(AirlockStatus,-1,1,-6.8,-4.8,15,20);
Crew.SetMembersPosRotOnEVA(_V(0,-5.8,16.0),_V(0,0,0));
//optional define here camera that show this dock
break;
case 1:
Crew.DefineAirLockShape(AirlockStatus,-1,1,-22.9,-17.9,-5,-2);
Crew.SetMembersPosRotOnEVA(_V(0,-18.9,-3.8 ),_V(-1.6,0,0));
Crew.SetMembersPosRotOnEVA(_V(0,-5.8,16.0),_V(0,0,0));
//optional define here camera that show this dock
break;
}
}


In clbkConsumeBufferedKey define the two key that will select wich dock is active:

Code: [Select]
// change active dock
if(key==OAPI_KEY_SUBTRACT)
{
if(iActiveDockNumber > 0)
iActiveDockNumber--;
sprintf(SendFocusScreenMessage(),"Active dock number changed to: %i",iActiveDockNumber);
SetUMMUAirlockPos();
return 1;
}
//---------------------------------------------------------------------------
// change active dock
if(key==OAPI_KEY_ADD)
{
if(iActiveDockNumber < 2)
iActiveDockNumber++;
sprintf(SendFocusScreenMessage(),"Active dock number changed to: %i",iActiveDockNumber);
SetUMMUAirlockPos();
return 1;
}


Don't forget in clbkSetClassCap to initialise your variable and call the fonction that set UMMU parameters:

Code: [Select]
iActiveDockNumber=0;
SetUMMUAirlockPos();


Voila, nice UMMUing !

Dan



Message modifié ( 11-11-2009 14:11 )

« Last Edit: 10 September 2007, 14:09:13 by DanSteph »