Sto cercando di creare un gioco con la fisica newtoniana.
Prima di leggere il resto, questa è la mia domanda principale, sto cercando di trovare una risposta a:
- Continuo a ricevere un errore che viene visualizzato in una finestra dopo aver tentato di eseguire il mio codice. Quale libreria o dll mi manca?
Ho una mela, un'arancia e una matita. Ho letto la maggior parte della documentazione con il motore di fisica dei proiettili, ma non riesco proprio a far sì che la mela si comporti come un pezzo di carta (2d-ish). I motori fisici Box2d e simili non sono quello che voglio. Non mi piacciono le scatole nella vita reale, figuriamoci nei cyber-mondi.
Voglio che la mela galleggi a terra, oscillando avanti e indietro come farebbe un pezzo di carta. Questo sito ha fornito alcune informazioni utili che ho integrato nel mio codice: htp: //www.3dbuzz.com/vbforum/showthread.php? 50854-Please-HELP !! -Simulating-paper-floating-to-ground
Ho questa idea per un gioco in cui gli oggetti si comportano come altri tipi di oggetti, ma le mie simulazioni del gioco non funzionano.
Ho attraversato troppi tipi di mele per contarle, e nessuna di esse si è nemmeno avvicinata. Ho provato a cercare altre persone che hanno provato cose simili (usando google come http://lmgtfy.com/?q=simluating+game+apples+in+real+life ), ma non sono mai state restituite mele!
Quindi, penso che andrò in un nuovo territorio qui (non preoccuparti, aprirò le mie tecniche) ed è per questo che le cose non funzionano per me.
Ho provato a programmare diversi tipi di mele, ma forse ho bisogno di una cyber apple? Non so dove trovarne uno, forse in un posto come questo: http://cyberapples.com/ Quel sito è chiuso per ora, però - parla sempre solo di un bidone della spazzatura o qualcosa del genere. Qualche consiglio anche su questo?
Questa è la parte del mio codice che tratta della mela che simula un gioco:
///... /* setup other objects in the room and other stuff */ ...
// see http://www.orangepippin.com/apples/arlet-swiss-gourmet
// for more arlet apple details
paper_2d_behaving_apple = new ArletApple[);
/ setup the arlet apple's general characteristics
paper_2d_behaving_apple.species = SPECIES.MALUS_DOMESTICA;
paper_2d_behaving_apple.parentage = PARENTAGE.GOLDEN_DELICIOUS_X_IDARED:
paper_2d_behaving_apple.introduced = make_year(1958);
paper_2d_behaving_apple.fruitColor = COLORS.red;
paper_2d_behaving_apple.fleshCOlor = APPLE_FLESH_COLORS::CREAM;
paper_2d_behaving_apple.fruitSize = GENERIC_FRUIT_SIZES.MEDIUM;
paper_2d_behaving_apple.GoodFor.add("eating fresh");
paper_2d_behaving_apple.GoodFor.add("cooking");
paper_2d_behaving_apple.GoodFor.add("use / keeping: 3 months or more");
paper_2d_behaving_apple.GoodFor.add("ripening PERIOD: 3 months or more");
paper_2d_behaving_apple.diseaseResistances = [DISEASE_RES::SCAB, DISEASE_RES::MILDEW];
///... (I cut some of this out for brevity's sake) ...
///* setup this specific apple's characteristics
paper_2d_behaving_apple.base_color = 0xff2000;
paper_2d_behaving_apple.bumpMap = BUMP_MAP_APPLE;
paper_2d_behaving_apple.texture = TEXTURE_REALISTIC_APPLE;
paper_2d_behaving_apple.feel_texture = SMOOTH;
paper_2d_behaving_apple.has_small_orangey_stripes = TRUE;
paper_2d_behaving_apple.DoesntHaveStem = FALSE;
paper_2d_behaving_apple.juicy = true; // needs a lowercase true for some reason
paper_2d_behaving_apple.has_bugs = false; // heck no it doesn't, I only buy good apples
///... (again I cut some stuff out so this post would'n't be too long) ...
// from http://www.3dbuzz.com/vbforum/showthread.php?50854-Please-HELP!!-Simulating-paper-floating-to-ground
// "i think reactor can do this, i would try cloth witha high air resistance and a very high stifness"
paper_2d_behaving_apple.addReactor(REactor());
// got this technique from http://www.gimptutorials.eu/html/clothify_filter_gimp_gnu.html
import gimp ; GIMP::Clothify(paper_2d_behaving_apple); pass
// / 7 should be high enough - it's a big number
paper_2d_behaving_apple.reactor.stiffness = 7.0f;
paper_2d_behaving_apple.reactor.airResistance = 5.0f; // high, but not "very high"
// setup the world the apple exists in
paper_2d_behaving_apple.owner = new BobFlanderson();
paper_2d_behaving_apple.owner.appearance = APPEARANCE_AWESOME;
paper_2d_behaving_apple.owner.clothes.size = CLOTHES_SIZE_MEDIUM;
paper_2d_behaving_apple.owner.owns_house = false;
paper_2d_behaving_apple.owner.apartment.sucks = true;
paper_2d_behaving_apple.owner.has_wife = false;
paper_2d_behaving_apple.viewSpace = LIVING_ROOM;
paper_2d_behaving_apple.RESTINGon = Kitchen.GetSurfaces()->COUNTER_BY_STOVE;
////... (also cut some more out here too) ...
// transform the paper behaving apple into something viewable
view_matrix = new ViewMatrix();
view_matrix.DoTransformation(paper_2d_behaving_apple);
view_matrix.makeViewable();
World->ApplyViewMatrix(view_matrix);
paper_2d_behaving_apple.RenderToNeakedEye();
// THIS IS WHERE I'm HAVING THE TROUBLE
actual_existing_apple_on_myCounter = new ExistingApple(paper_2d_behaving_apple);
actual_existing_apple_on_myCounter.bindInRealLive();
// THIS NEVER WORKS! I DON"T KNOW HOW YOU GUYS DO THIS STUFF!
actual_existing_apple_on_myCounter.Translate(LANGUAGES::ENGLISH);
// saw the IW_FIXED on some jam making site
// (http://www.madewithmarmalade.com/devnet/documentation#/api/api/group__IwGeomCore.html)
// - that's the closest I've come to seeing anything close to what
// I'm trying to do
actual_existing_apple_on_myCounter.TranslateTo(0, 0, IW_FIXED(10.0f));
apple_now_inAir = actual_existing_apple_on_myCounter;
// I know this is C++ code, but some ruby sites were saying that it's best
// to put an exclamation point after a function that modifies a physical
// object - no luck yet for me
apple_now_inAir.Drop!();
Come puoi vedere, ho giù i concetti di base e sono molto descrittivo con i miei nomi di variabile e gli attributi dell'oggetto. Ho impostato il mondo in modo molto succinto e chiaro, anche se ho semplificato il mondo nel gioco rispetto alla cucina reale.
Penso che il problema sia quello di legare paper_2d_behaving_applealla actual_existing_apple_on_myCountermela e quindi trasferirlo a quello nell'aria ( apple_now_inAir);
In ogni caso, e non importa quanto bene formatta tutto, nulla sembra accadere. Di seguito un'immagine di come eseguo il programma:

Qualcuno l'ha mai incontrato prima? Grazie in anticipo. Sto solo iniziando con i giochi di programmazione, avendo recentemente cambiato carriera, quindi non sentirti male.
Grazie Bob
apple_now_inAir.Drop!();- è una rivolta. C'è qualcosa in questo post - ambizioso, confuso, condannato ...
