0 Members and 1 Guest are viewing this topic.
Momo a écrit:vi sa marche! merci!j'ai juste une lacune, ... je voudrais crée un point d'attache parent (crée dans mon cfg comme lehst) et attraper un enfant en appuyant sur une touche... j'ai regardé partout mais je trouve pas la commande a rentrer sous if(key==OAPI_KEY_xxx) {un peut comme tu as fais avec le Ummu (touche G pour attrapé un objet avec les mains) sinon a part sa, tous marche!
justement les exemples de la SDK sont la pour ca.
Premier arret: la doc, "API_Reference.pdf" on charge, on cherche "attache"
int sas::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate){.../... if(key==OAPI_KEY_E) attachment = CreateAttachment (true,_V(0,1,0)... ... ... );
if (!rms_attach) rms_attach = CreateAttachment (false, ofs+arm_tip[0], arm_tip[1]-arm_tip[0], arm_tip[2]-arm_tip[0], "G", true);
OAPI_KEY_8: ToggleGrapple();
La prog c'est d'abord être un detective, une fois que tu admis ca tu ne sera plus jamaisperdu. Nos outils sont: la doc, les autres codes sources, google.
Je pourrais te donner la réponse mais ca n'arrangerais pas ton problème de methode et tu calerais à chaque étapeset finirais par abandonner
Capisce ? ... OUI mon général !C'est bien, repos !
DanSteph a écrit:si je comprend bien tu fait un sas "generique" qui pourrait s'attacher sur tes autres modules ?Dan
Momo a écrit:sinon, j'arrive toujours pas a accroché le parent au tio... via if(key==OAPI_KEY_E)...
DanSteph a écrit:QuoteMomo a écrit:sinon, j'arrive toujours pas a accroché le parent au tio... via if(key==OAPI_KEY_E)... Je le fait par "AttachChild", controle bien que tes handles soient corrects. (parametres de attachchild)Dan
if(key==OAPI_KEY_E) { VECTOR3 gpos, grms, pos, dir, rot; VECTOR3 gdir,grot; VECTOR3 gcdir,gcrot; GetAttachmentParams (sas_attachment, pos, dir, rot); Local2Global (pos, grms); //local attach point to global frame GlobalRot(rot,grot); GlobalRot(dir,gdir); for (DWORD i = 0; i < oapiGetVesselCount(); i++) { OBJHANDLE hV = oapiGetVesselByIndex (i); if (hV == GetHandle()) continue; // we don't want to grapple ourselves ... oapiGetGlobalPos (hV, &gpos); if (dist (gpos, grms) < oapiGetSize (hV)) { // in range VESSEL *v = oapiGetVesselInterface (hV); DWORD nAttach = v-> AttachmentCount (true); OBJHANDLE hV = GetAttachmentStatus (sas_attachment); for (DWORD j = 0; j < nAttach; j++) ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle (true, j); const char *id = v->GetAttachmentId (hAtt); <=== ligne 70 if (strncmp (id, "SH", 2)) continue; // attachment point not compatible v->GetAttachmentParams (hAtt, pos, dir, rot); v->Local2Global (pos, gpos); if (dist (gpos, grms) < MAX_GRAPPLING_DIST) { // found one! // check if the attachment points are pointing the right way v->GlobalRot(rot,gcrot); v->GlobalRot(dir,gcdir); //should be normal by now if ((dotp(grot,gcrot)>MAX_GRAPPLING_ANG)&&(dotp(gdir,gcdir)<-MAX_GRAPPLING_ANG))//dotrot=1 and dotdir=-1(same up vector, but opposing dir vectors) { AttachChild (hV, sas_attachment, hAtt); return false; } } } } } }
Projet : sas_prj, Configuration : Debug Win32 Sas.cppc:\orbitersdk\samples\sas\sas.cpp(70) : error C2065: 'hAtt' : identificateur non déclaré
Momo a écrit:Bon ben plus de prb de compile... mais un gros prb de fonctionnement...E ne sort plus les Ummu et pas d'attache sur le point enfant du module hab...