Allegro.cc Forums » The Depot » projectile physics

 altalena Member #13,639 October 2011 Wow i feel stupid for not figuring this matrix vector thing out sooner. One less thing on my to-do list i guess.``` unit_vector[0]=1.0*cos(phi*M_2PIE/400.0)*cos(theta*M_2PIE/400.0); unit_vector[1]=1.0*sin(phi*M_2PIE/400.0)*cos(theta*M_2PIE/400.0); unit_vector[2]=1.0*sin(theta*M_2PIE/400.0); unit_vector[3]=1.0*cos((phi-100.0)*M_2PIE/400.0)*cos(theta*M_2PIE/400.0); unit_vector[4]=1.0*sin((phi-100.0)*M_2PIE/400.0)*cos(theta*M_2PIE/400.0); unit_vector[5]=1.0*sin(theta*M_2PIE/400.0); unit_vector[6]=1.0*cos(phi*M_2PIE/400.0)*cos((theta+100.0)*M_2PIE/400.0); unit_vector[7]=1.0*sin(phi*M_2PIE/400.0)*cos((theta+100.0)*M_2PIE/400.0); unit_vector[8]=1.0*sin((theta+100.0)*M_2PIE/400.0); ``` That's how to make the unit vectors for 2-axis rotation, I'm using 400ths of a circle to avoid rounding errors from using radians. Obviously, use 360 for 400 and 90 for 100 if you're using degrees. 0-2 is out vector, 3-5 is right vector, and 6-8 is up vector.I have no idea how to get the image to load in my program, however. ...At the briefest instant following creation all the matter of the universe was concentrated in a very small place, no larger than a grain of mustard. The matter at this time was very thin, so intangible, that it did not have real substance. It did have, however, a potential to gain substance and form and to become tangible matter. From the initial concentration of this intangible substance in its minute location, the substance expanded, expanding the universe as it did so. As the expansion progressed, a change in the substance occurred. This initially thin noncorporeal substance took on the tangible aspects of matter as we know it. From this initial act of creation, from this ethereally thin pseudosubstance, everything that has existed, or will ever exist, was, is, and will be formed. - the RaMBaN, 1194 - 1270ג וּשְׁאַבְתֶּם-מַיִם, בְּשָׂשׂוֹן, מִמַּעַיְנֵי, הַיְשׁוּעָה. - Yeshayahu 12:3
 Arthur Kalliokoski Second in Command February 2005 altalena said: I have no idea how to get the image to load in my program, however. ```If you're using an IDE, it's probably messing up your current directory, so try this ALLEGRO_PATH *path; path = al_get_standard_path(ALLEGRO_RESOURCES_PATH); al_change_directory(al_path_cstr(path,ALLEGRO_NATIVE_PATH_SEP)); ``` What? You already have allegro_image.h in your include list. ``` ALLEGRO_BITMAP *random_image_ptr; random_image_ptr = al_load_bitmap("my_random_image.bmp"); if(random_image_ptr == 0) { //al_show_native_message_box(0,"Error","Unable to load terrain file","",NULL,0); fprintf(stderr,"Can't load terrain image\n"); return 1; } ``` [EDIT]Oh, yeah, you'll have to link in allegro_image.lib or whatever depending on your compiler.[EDIT2]FIXED: I should have stuck in the path stuff before the al_load_bitmap part “Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”― Robert A. Heinlein
 altalena Member #13,639 October 2011 Ok. I'm linking in C:\allegro\liballegro_image-5.0.8-static-mt.a and I'm linking to all the other static libraries suggested by the code::blocks+mingw page on the wiki.I'm compiling the project and then running the .exe from an icon pinned to my w7 task bar. I put in the code ``` ALLEGRO_PATH *path; path = al_get_standard_path(ALLEGRO_RESOURCES_PATH); al_change_directory(al_path_cstr(path,ALLEGRO_NATIVE_PATH_SEP)); ``` before trying to load the bitmap.I've attached my latest code, attempting to get this working. I appreciate the help. ...At the briefest instant following creation all the matter of the universe was concentrated in a very small place, no larger than a grain of mustard. The matter at this time was very thin, so intangible, that it did not have real substance. It did have, however, a potential to gain substance and form and to become tangible matter. From the initial concentration of this intangible substance in its minute location, the substance expanded, expanding the universe as it did so. As the expansion progressed, a change in the substance occurred. This initially thin noncorporeal substance took on the tangible aspects of matter as we know it. From this initial act of creation, from this ethereally thin pseudosubstance, everything that has existed, or will ever exist, was, is, and will be formed. - the RaMBaN, 1194 - 1270ג וּשְׁאַבְתֶּם-מַיִם, בְּשָׂשׂוֹן, מִמַּעַיְנֵי, הַיְשׁוּעָה. - Yeshayahu 12:3