Setting up your Template File

Choose any two planets you'd like to travel between. Because rockets are small, we need a smaller delta to make sure the rocket doesn't just fly straight into the planets. For the sake of time, we'll only be simulating 3 bodies:

  • The star in the system (the Sun)

  • The starting planet (the Earth)

  • The destination planet (Mars)

Here's an example template file for this:

{
    "name": "rocket-launch",
    "author": "jewels86",
    "limit": "300d",
    "delta": "10min",
    "t": 0,
    "bodies": [
        {
            "name": "Sun",
            "mass": 1.989e30,
            "radius": 6.95e8,
            "r": [[0, 0, 0]],
            "v": [[0, 0, 0]]
        },
        {
            "name": "Earth",
            "mass": 5.972e24,
            "radius": 6.371e6,
            "r": [[1.496e11, 0, 0]],
            "v": [[0, 0, 2.98e4]]
        },
        {
            "name": "Rocket",
            "mass": 5e4,
            "radius": 5,
            "r": [[1.496e11, 0, 0]],
            "v": [[0, 0, 0]]
        },
        {
            "name": "Mars",
            "mass": 6.417e23,
            "radius": 3.3895e6,
            "r": [[2.279e11, 0, 0]],
            "v": [[0, 0, 2.41e4]]
        }
    ]
}
```

Note that the Rocket starts with no velocity. This is because any velocity we apply wouldn't keep the rocket on the surface of the Earth due to gravity. Also notice that we've started the rocket at the center of the Earth. For this simplified simulation, it doesn't matter, but if we needed to, we could add the radius to the x position to start on the surface of the Earth.

Write your own template file for your rocket launch. Remember to:

  • Start your rocket near the starting body

  • Give your rocket 0 starting speed

  • Create at least 4 bodies

Last updated