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=31Features:-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 usedSetActiveDockForTransfer()
DefineAirLockShape()
Optionnal fonction for camera:SetCameraOffset();
SetCameraDefaultDirection();
walktroughtFirst declare a new variable in your header that will contain the current active dock:
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:
///////////////////////////////////////////////////////////////////////////////////////////
// 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:
// 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:
iActiveDockNumber=0;
SetUMMUAirlockPos();
Voila, nice UMMUing !
Dan
Message modifié ( 11-11-2009 14:11 )