tag:blogger.com,1999:blog-2403477577476951601.post6721909884467237782..comments2024-03-24T17:52:29.632-07:00Comments on PlayTechs: Programming for fun: Multi-planet prototypingJames McNeillhttp://www.blogger.com/profile/08901649215141005959noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-2403477577476951601.post-76653606392857829512011-02-02T01:13:56.623-08:002011-02-02T01:13:56.623-08:00Do post a screenshot or concept imagery! :)Do post a screenshot or concept imagery! :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-35574481967752523842011-01-25T13:28:23.491-08:002011-01-25T13:28:23.491-08:00cool thanxcool thanxowenhttps://www.blogger.com/profile/09989384856313244450noreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-59378796116273319182011-01-25T08:02:06.764-08:002011-01-25T08:02:06.764-08:00There are 2.0*M_PI radians in a full circle (so 18...There are 2.0*M_PI radians in a full circle (so 180 degrees = M_PI radians). If you change your degrees-to-radians computation to this:<br /><br />float radians = ra * M_PI / 180;<br />dx = cos(radians);<br />dy = sin(radians);<br /><br />...then ra can be wrapped at 360 instead of 240.James McNeillhttps://www.blogger.com/profile/08901649215141005959noreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-37280414029365175732011-01-24T09:14:04.189-08:002011-01-24T09:14:04.189-08:00no prob, I had the page in my feed reader. don...no prob, I had the page in my feed reader. don't have a clue what you just said but I'll take you word for it. lol. Sounds like you have it solved unless you are having problems with many to one attenuation.<br /><br />Just last night I tried hacking together a system but I'm getting a weird 240 number. What's wrong with this? I pass the center point to the function and the box spins around it;<br /><br />void planets(float x, float y, float z ){<br /><br /> float gap=105; //distance from center point<br /> float d=360, dx=0, dy=0;<br /> static float ra; <br /> <br /> ra+=0.3;<br /> if(ra > 240) ra=0; //magic number<br /><br /> dx = cosf( M_PI * 3.0f * ra / d );<br /> dy = sinf( M_PI * 3.0f * ra / d );<br /><br /> do_draw_box( x+(gap * dx), y+(gap * dy), z, 0, YELLOW, 13, 13, 13 );<br /> //do_draw_box( b.x+(gap * dy), b.y+(gap * dx), b.z, a, b.colour, 3, 3, 3 );<br /><br />}owenhttps://www.blogger.com/profile/09989384856313244450noreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-82478850207950577922011-01-23T21:14:16.965-08:002011-01-23T21:14:16.965-08:00Owen,
Sorry for getting back so late.
The force ...Owen,<br /><br />Sorry for getting back so late.<br /><br />The force of gravity between two bodies is something like this:<br /><br /> F = (m1 * m2) / d^2<br /><br />It's proportional to both masses, and inversely proportional to the square of the distance between them. Since acceleration is force divided by mass, each body's acceleration effectively proportional to the other body's mass (and inversely proportional to the squared distance between them):<br /><br /> a1 = m2 / d^2<br /> a2 = m1 / d^2<br /><br />If the spacecraft's mass is very small relative to the planet then the planet's acceleration due to the spacecraft is negligible. As you move from planet to planet, it's that "inversely proportional to the squared distance" part that rapidly attenuates one planet's influence and increases another's.James McNeillhttps://www.blogger.com/profile/08901649215141005959noreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-39920338109628281652011-01-19T06:58:50.584-08:002011-01-19T06:58:50.584-08:00I hate physics but maybe you are not calculating t...I hate physics but maybe you are not calculating the mass of the player in relation to the other objects. I guess that the way gravity works is that the gravity of bigger objects only affect objects that are as big as they are. hence the sun's gravity only affects the planets (the next biggest objects). Then the planet's gravity only affects the player and the moons. So the sun realy doesn't affect the player because he is too small. Hope that makes some sense. So as the player escapes the one planets gravity, then the gravity of the next closest thing bigger that he is the gravity that he should be attracted to.owenhttps://www.blogger.com/profile/09989384856313244450noreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-2334747273263264392011-01-18T08:15:26.688-08:002011-01-18T08:15:26.688-08:00I'll give that a try. My concern is that it wi...I'll give that a try. My concern is that it will produce noticeable discontinuities at the boundaries between influence areas. I have various trajectory plots that could make it obvious. Maybe it won't be too bad though.James McNeillhttps://www.blogger.com/profile/08901649215141005959noreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-62296789675836180072011-01-18T00:09:37.961-08:002011-01-18T00:09:37.961-08:00I "solved" a similar problem by having o...I "solved" a similar problem by having only the planet with the strongest local gravity affect the player. The planets itselves would orbit on fixed ellipses.kometbombhttps://www.blogger.com/profile/06293630038391333837noreply@blogger.com