This example creates an aircraft carrier and an embarked helicopter.
It demonstrates creation of an embarked entity. This example works in DIS and HLA using Version 2.0017 of the RPR FOM. Embarkation is not supported in earlier versions of the RPR FOM.
In this example we create an aircraft carrier located in the Indian Ocean on the Makland Terrain Database. We also create a helicoper and embark it on the deck of the carrier.
To exit, press the 'q' key. This example works with the MAK Stealth and the VR-Forces products.
int keybrdTick()
{
if (keyPtr && (*keyPtr == 'q' || *keyPtr == 'Q'))
return -1;
else
return 0;
}
int main( int argc, char* argv[] )
{
try
{
#if DtDIS
appInit.setDisVersionToSend(7);
#else
appInit.setFedFileName(DtDefaultRpr2Fom);
appInit.setExecName("MAK-RPR-2.0");
appInit.setRprFomVersion(2.0);
#endif
appInit.parseCmdLine();
#ifdef DtHLA
"Carrier"
#else
#endif
);
carrierPub.entityStateRep()->setEntityId("3:2:1");
carrierPub.entityStateRep()->setMarkingText("Carrier");
#ifdef DtHLA
"Helicopter"
#else
#endif
);
helPub.entityStateRep()->setEntityId("3:2:2");
helPub.entityStateRep()->setMarkingText("Helicopter");
htv.setLocation(
DtVector(0.0,0.0,-33.0));
helPub.entityStateRep()->setHostGlobalId(carrierPub.globalId());
helPub.entityStateRep()->setRelativeAlgorithm(
DtDrStatic);
helPub.entityStateRep()->setRelativeLocation(
DtVector(0,0,-33.0));
while (!keybrdTick())
{
exConn.drainInput();
carrierPub.tick();
helPub.tick();
simTime += dt;
}
}
return 0;
}