I’m working on some very simple planet simulations - in which planets orbit a star using a modified gravitational formula.
(example image below shows two planets orbiting a star)
I want to draw their orbit paths/trajectories but i’m not sure how to do that. If there’s a way to graphically draw a path that would be nice(ie. I input a projected position formula for the x and y axis to see where it will be going)
There’s nothing built-in for that task, and it’s actually not that simple to do if you want to have an accurate physics-calculated orbit. You’d need to simulate tens or hundreds of physics frames each actual frame and mark position of the planet to form the orbit.
If your planets interact only with the sun, then that may be doable (although I failed at trying to make anything useful and accurate), but if you want your planets to interact with each other too, then I’d have to say it’s super difficult and have very expensive simulation calculations.
It’s much easier to do draw an orbit retrospectively.
I have thought about it and it should be possible since I can only update the path when needed (ie draw the path of orbit to an extent, and then not update it until something is changed)
Issue is I don’t know the means to draw this sort of stuff
It’s definitely not ideal, but maybe will get you started in your own direction.
You could use the same principle to simulate multi-body physics (currently the planets interact only with the Sun’s gravity).
Let me know if you have any issues implementing this in your project!
yup! It uses some shaders for the planets which make it look cleaner, I haven’t yet implemented what you mentioned though as i’ve run into some other issues lmao