Hollow Planets
October 1, 2018
I got a great question from someone who’d been using GSim – let’s call them B.A.
To paraphrase: can you make a ‘hollow’ planet in the simulator, and test out how gravity would work inside it.
This ended up being a more interesting challenge than I realized, so I figure I’d share my response with all of you:
…
Ah, good question – I had to think about that one a bit. The short answer is, yes.
Right now, if you have a single star and put an asteroid inside it… it will get absorbed. *But* if you place a static star, then put a *planet* inside it (while the collisions are turned off), then it won’t get absorbed, and it will move around affected by the gravity of the star.
In that case, though, the star isn’t treated as hollow, but instead as having a constant density. So just like if you drilled a hole all the way through the earth, where you’d fall down, feeling the varying effects of gravity as you did.
I don’t think that’s what you mean by hollow object, though. To create something truly hollow, which would have all its mass on an outer shell, we’ll have to get more creative.
At first I tried making a ring of smaller stars, to act like the outer shell of an object. The code is here:
//Gravity fun at TestTubeGames
_settings(gravity: r^-2);
_addCircle(vt: 0, r: 150, num: 400, col: 1, t: 0, m: 10, lcol: 0, noGrav);
If you try that, and throw in a few asteroids, you’ll notice that this doesn’t behave like you’d expect at all. Turns out, we made a flat ring, not a 3D shell, and they behave quite differently.
If you have the full version of the sim (the downloadable one), then you can set the simulation to be calculating in 2 dimensions, using the Physics menu, and that kind of helps — though introduces the issues that come along with calculating physics in different dimensions.
Well…
Then it struck me that a more straightforward(?) way to do this would be to create a star with negative mass… and put that *inside* the star with positive mass. (Negative mass is just a fun theoretical thing you can explore in the sim… but it’s very helpful here). If the two have the same density, then the negative mass and positive mass in any overlapping areas would cancel out to zero. With a slightly lower mass negative star overlapping a positive mass star, then, we can create a hollow object.
Here’s some code to try it out:
//Gravity fun at TestTubeGames
_settings(gravity: r^-2, x: 2.522413, y: 1.124918, zoom: 18.72843);
_add(m: 10000, col: 2, lcol: 3, pic: 0, noGrav, x: 0, y: 0);
_add(m: -9900, col: 16, lcol: 3, pic: 0, noGrav, x: 0, y: 0);
Make sure collisions are off, then fling some asteroids* in there. You should be good to go.
*due to an issue with the way density is calculated, stick with asteroids for this test for now. Planet behavior inside a hollow object is a bit broken.
-Andy