This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

I want to recreate the mobile game Spaceflight Simulator in godot. If you haven’t heard of it, I highly recommend you give it a try, it’s free and a small file size. Basically, it’s a simple 2D orbital mechanics simulator. So far, I have a Rigidbody rocket I can fly and an Area2d planet that acts as a gravity point. What I need help with is:
- How I can make the planets orbit around the sun.
- How I can display the current trajectory of your rocket
- How I can deal with navigation (how to set up transfers and such)
It really isn’t super important that I perfectly replicate the game or make it super realistic. I’m not actually looking to make a simulator, I just want to implement spaceflight in my sandbox game. Thanks in advance for any help!

Godot version 3.0
in Engine by (67 points)

Not answering to your problem but ask a question :
Do you try to detach some part of your rocket ?

1 Answer

0 votes

For orbiting planets :

  • First, get yourself a function, that puts the planet on the right spot based on a fraction (0-1, 0-360 or 0-2PI). For circles, you simply use cos, sin, and multiply by the distance. If you want proper orbits, they are elipses, with the sun as one of the focus points.
  • Then, use a Tween to call your function repeatedly, over the desired time and interval.

For your trajectory, either calculate it yourself, or just shoot little indicators, with the same physics as your spaceship.

For navigation, I have no clue what you mean by that. If it is camera movement related, then you will also want to use Tweens to make the movement more natural.

by (2,720 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.