Hello, I have been trying to implement a basic host, I have managed to control the entity using the EntityControl class, but I am unable to rotate an articulated part present in the simmodel of that entity. Related code is as below,
/* CIGI messaging */ // Reference an Outgoing Message Manager CigiOutgoingMsg &Omsg = *OmsgPtr; // Step 13 : Call the Outgoing message object "BeginMsg()" method to initialize the message Omsg.BeginMsg(); // The normal per frame sequence of the operation of the HOST // 1 : Process the current message from the IG if any if (CigiInSz > 0) { try { pin_ptr<unsigned char *> unmanagedCInBuf = &CInBuf[0]; ImsgPtr->ProcessIncomingMsg((unsigned char *)unmanagedCInBuf, CigiInSz); } catch (CigiException &theException) { Console::Write("getNetMessages - Exception: "); Console::WriteLine(theException.what()); } } // 2 : Modify the IG Control Object as needed // 3 : Pack the IG Control packet onto the outgoing message buffer Omsg << CIGC; // 4 : Create, Modify, and pack other packets as necessary // Modify COwn Entity Control Packet as needed COwn.SetLat(lat, false); COwn.SetLon(lon, false); COwn.SetAlt(alt, false); COwn.SetRoll(roll, false); COwn.SetPitch(pitch, false); COwn.SetYaw(yaw, false); // 5 : Pack Entity Control Packet Omsg << COwn; // 6 : Modify the Articulated Part control packet as required CArtPart.SetEntityID(1); CArtPart.SetArtPartID(partID); CArtPart.SetArtPartEn(true); CArtPart.SetRoll(90); CArtPart.SetRollEn(true); CArtPart.SetPitchEn(true); CArtPart.SetPitch(90); // 7: Pack the Art Part Packet Omsg << CArtPart; // 8 : Package the message try { pin_ptr<unsigned char *> unmanagedCigiOutBuf = &pCigiOutBuf; pin_ptr<int> unmanagedCigiOutSz = &CigiOutSz; Omsg.PackageMsg(unmanagedCigiOutBuf, *unmanagedCigiOutSz); } catch (CigiException &theException) { Console::Write("getNetMessages - Exception: "); Console::WriteLine(theException.what()); } // 9 : Wait and receive the IG's SOF message CigiInSz = 0; while (CigiInSz == 0) { pin_ptr<unsigned char *> unmanagedCInBuf = &CInBuf[0]; CigiInSz = network.recv((unsigned char *)unmanagedCInBuf, RECV_BUFFER_SIZE); } // 10 : Update the IG control (specifically the frame counter and possibly the database ID) packet in the outgoing message buffer // 11 : Send the outgoing mesage if (pCigiOutBuf != NULL) { if (CigiInSz > 0) { pin_ptr<unsigned char *> unmanagedCInBuf = &CInBuf[0]; Omsg.UpdateIGCtrl(pCigiOutBuf, (unsigned char*)unmanagedCInBuf); } else { Omsg.UpdateIGCtrl(pCigiOutBuf, NULL); } // send CIGI message int sentBytes = network.send(pCigiOutBuf, CigiOutSz); } Omsg.FreeMsg(); // Frees the buffer containing the message that was just sent
Log in to post a comment.
Hello, I have been trying to implement a basic host, I have managed to control the entity using the EntityControl class, but I am unable to rotate an articulated part present in the simmodel of that entity. Related code is as below,