Well got good fps. I just painted on the labels that were fuzzy. All that we lack is the ranger. The code is the part we have to fix. I think I know what the issue is but not sure how to fix it. We have the code in a bitbucket if any one want s to dare.
---------- Post added 12-16-16 at 04:53 AM ---------- Previous post was 12-15-16 at 08:37 AM ----------
Well another issue. The Lander has 2 attachment points for cargo pods. Their are 2 keys of keys to attach/detach.
What happens is if one point has a pod. When you try to attach a new vessel/pod. It steals the attached vessel.
So how can I tell it only attached vessels not attached?
CARGO1 = CreateAttachment(false, _V(0, 3.365, 1.30), _V(0, 0, 1), _V(0, -1, 0), "CARGO1");
CARGO2 = CreateAttachment(false, _V(0, 3.365, -.35), _V(0, 0, 1), _V(0, -1, 0), "CARGO2");
---------- Post added 12-16-16 at 04:53 AM ---------- Previous post was 12-15-16 at 08:37 AM ----------
Well another issue. The Lander has 2 attachment points for cargo pods. Their are 2 keys of keys to attach/detach.
What happens is if one point has a pod. When you try to attach a new vessel/pod. It steals the attached vessel.
So how can I tell it only attached vessels not attached?
CARGO1 = CreateAttachment(false, _V(0, 3.365, 1.30), _V(0, 0, 1), _V(0, -1, 0), "CARGO1");
CARGO2 = CreateAttachment(false, _V(0, 3.365, -.35), _V(0, 0, 1), _V(0, -1, 0), "CARGO2");
Code:
void LANDER6::AttachCargo(){
VECTOR3 aphpos, aphdir, aphrot, gaph;
VECTOR3 shippos, shipdir, shiprot, gpship;
// get attachment point positions based on selected point
// get attachment point positions based on selected point
GetAttachmentParams(CARGO1, aphpos, aphdir, aphrot);
// change the position to a global one rather then a local one. This will allow me to offset it from the local center.
// the local position is stored in gaph
Local2Global(aphpos, gaph);
for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
// if (strncmp (hV->GetClassName(), "QJFFS", 5)!=0 ){ //restrict to only QuadJ ships to make it easy.
// Look for any ship with a child attach point. This allows the Mule to grap any object
if (hV == GetHandle()) continue; // If self then continue onward because we don't want to grapple ourselves ...
oapiGetGlobalPos(hV, &gpship); // get global postion of ship and put into gpship
if (dist(gpship, gaph) < oapiGetSize(hV)) { // Make sure that the ship is close enough to the mule
// looks close enough so lets look for that attach point
VESSEL *v = oapiGetVesselInterface(hV);
// Only look for child attach point
DWORD nAttach = v->AttachmentCount(true); //Get attachment count. I do this so that I can grap any child point.
if (nAttach > 0){ // Only continue if ship has a child attach point
for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate and check how far away from the attach point it is
ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
//* thiswould allow me to filter out all but QJ ships but I don't want to right now
const char *id = v->GetAttachmentId(hAtt);
if (strncmp(id, "LANDER", 6)) continue; // attachment point not compatible
// */
v->GetAttachmentParams(hAtt, shippos, shipdir, shiprot); //lets get the attach point position
v->Local2Global(shippos, gpship); // and change it to a global position Recycle of gpship cause I can
if (dist(gpship, gaph) < MAX_GRAP_DIST) { // Is it close enough to grab?
apd = dist(gpship, gaph);
// Yes! Then lets grab the little bugger and get out of here
// Yes! Then lets grab the little bugger and get out of here
if (do_attach > 0){
do_attach = 0;
if (!GetAttachmentStatus(CARGO1))
{
//Free so do the attach
AttachChild(hV, CARGO1, hAtt);
CARGO1ATTACH = 1;
}
else{
//something already attached
}
}
}
return;
}
}
} // End of for j
}
}
void LANDER6::DetachCargo()
{
DetachChild(CARGO1, 0.0);
CARGO1OLDATTACH = 1;
CARGO1ATTACH = 0;
}
void LANDER6::AttachCargo1(){
VECTOR3 aphpos, aphdir, aphrot, gaph;
VECTOR3 shippos, shipdir, shiprot, gpship;
// get attachment point positions based on selected point
// get attachment point positions based on selected point
GetAttachmentParams(CARGO2, aphpos, aphdir, aphrot);
// change the position to a global one rather then a local one. This will allow me to offset it from the local center.
// the local position is stored in gaph
Local2Global(aphpos, gaph);
for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
// if (strncmp (hV->GetClassName(), "QJFFS", 5)!=0 ){ //restrict to only QuadJ ships to make it easy.
// Look for any ship with a child attach point. This allows the Mule to grap any object
if (hV == GetHandle()) continue; // If self then continue onward because we don't want to grapple ourselves ...
oapiGetGlobalPos(hV, &gpship); // get global postion of ship and put into gpship
if (dist(gpship, gaph) < oapiGetSize(hV)) { // Make sure that the ship is close enough to the mule
// looks close enough so lets look for that attach point
VESSEL *v = oapiGetVesselInterface(hV);
// Only look for child attach point
DWORD nAttach = v->AttachmentCount(true); //Get attachment count. I do this so that I can grap any child point.
if (nAttach > 0){ // Only continue if ship has a child attach point
for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate and check how far away from the attach point it is
ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
//* thiswould allow me to filter out all but QJ ships but I don't want to right now
const char *id = v->GetAttachmentId(hAtt);
if (strncmp(id, "LANDER", 6)) continue; // attachment point not compatible
// */
v->GetAttachmentParams(hAtt, shippos, shipdir, shiprot); //lets get the attach point position
v->Local2Global(shippos, gpship); // and change it to a global position Recycle of gpship cause I can
if (dist(gpship, gaph) < MAX_GRAP_DIST) { // Is it close enough to grab?
apd = dist(gpship, gaph);
// Yes! Then lets grab the little bugger and get out of here
// Yes! Then lets grab the little bugger and get out of here
if (do_attach1 > 0){
do_attach1 = 0;
if (!GetAttachmentStatus(CARGO2))
{
//Free so do the attach
AttachChild(hV, CARGO2, hAtt);
CARGO2ATTACH = 1;
}
else{
//something already attached
}
}
}
return;
}
}
} // End of for j
}
}
void LANDER6::DetachCargo1()
{
DetachChild(CARGO2, 0.0);
CARGO2OLDATTACH = 1;
CARGO2ATTACH = 0;
}