Pics or it didn't happen
How do you counter the force of GMods normal gravity?
An idea came to me when I was making magnets with applyForce. That perhaps the same concept could be extrapolated into simulating gravity. To my amazement, and just a little tweaking, I was able to build a planet orbiting around a star. I was so transfixed with the concept I wrote an entire E2 to simulate gravitational interactions between multiple props. By launching them all in random directions I found that they would form into a neat little solar system and I had fun observing astrological events and naming my little planets.
However the current simulation I have can only account for one sun and several planets, adding more suns and moons creates some distinct problems. For starters, moons collide with the sun... ALOT. I imagine this happens in real life too but it just isn't practical in my simulation because rather then blowing up, the moons are shot via the slingshot effect across the map. The second, and perhaps larger problem, is size. As I quickly realized, the sun is about 400 times farther away then the moon. Meaning if I wanted to create any noticeable distance between a planet and its moon, the sun would have to be very far away, thus taking up a lot of space. This also follows suit with multiple suns which would have to be 250,000 times farther away then that!
The only thing I can think to do about distance is perhaps to make it exponential. So like if two objects were 1 unit away from each other the system would pretend they were 4, and if they were 4 units away the system would pretend they were 16. Yet I think that would turn into some rather big numbers.
This is turning into more then I expected.
Make a Small Loan, Make a Big Difference - Check out Kiva.org to Learn How!
I don't think that the distance would increase exponentially. Rather, I feel that you would need to find the correct constant for "distance" and multiply all the distances by that one constant.
That way, the amount of interaction between each body is the same, and only varies based on other factors (like the mass of each body, etc.)
id really like to see some pics or the actual e2. this sounds very fun.
DO YOU HEAR THE VOICES TOO?
I made a "gravity simulation e2" a while back for spacebuild, if you want to call it that. All it really does is applyForce props in the direction of the e2, all you have to do is get a good spin going and bam, got a nice orbit.
I recently posted a holo-based gravity simulator on my Gmod blog. Of course the primary problem with it is that in order to avoid tainting the results it can't be tied to a single position, so the elements eventually fly out of the map. They do make some remarkable patterns though.
The Olympus Technologies drones, totally not SkyNet in Gmod form.
Cronus: The Ultimate Drone, definitely SkyNet in Gmod form.
The gBrain Project, the drone controls system that thinks it's better than you
I made an expression simulating gravity once and it kinda worked, but GMod is not good for this. You can feed the inverse square law to applyForce and get quite good effects, but after some time the instability of the GMod physics engine starts to show. That's probably what causes moon-sun collisions you mentioned.
It would be easier to simulate gravity on holos, you could implement your own integrating algorithm, but that's another story![]()
My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
My tutorials: applyTorque - Quaternions - PID controllers
Some other things I made: FT Chip - RK4 Solar System
The Olympus Technologies drones, totally not SkyNet in Gmod form.
Cronus: The Ultimate Drone, definitely SkyNet in Gmod form.
The gBrain Project, the drone controls system that thinks it's better than you
I don't think you get what I mean. At first I had it set up with distance representing actual distance. However as I stated, this means that objects like two stars would have to be astronomically far away from each other to notice the distance between a star and a planet, or a planet and its moon.
That's a good idea. Perhaps to to have one sorta "black hole" in the center that holds everything to the map. But I believe I'd have the same problem I'm having with the colliding moons, just now it would planets colliding into the black hole.
That sounds like a good idea. I think I'm going to do that. I'll release the scrip it if I finish it. However it's just going to be harder to keep the astrological bodies in the map. As for the moon collisions, that is not sources fault, intact it happens all the time. Thousands of small astrological bodies get sucked stars. Only a few are lucky enough to brush a planet in the correct way that it gets trapped in its field rather then the a stars. It doesn't happen much in our galaxy becuase we've been developed for billions of years.
Last edited by SystemsLock; 01-30-2010 at 11:16 AM.
Make a Small Loan, Make a Big Difference - Check out Kiva.org to Learn How!
Bookmarks