What is the best way to orbit objects in a scientific-like elliptical orbit?
It's quite possible that I'm in way over my head, but I decided to simulate 67 moons orbiting Jupiter.
I found lots of great data, but it's not fully complete for a Newtonian simulation.
I also found an interesting elliptical example and converted it into C#:
//x, y: center of the ellipse
//a, b: semimajor and semiminor axes
using UnityEngine;
using System.Collections;
public class ElipseOrbit : MonoBehaviour {
public float a;
public float b;
public float x;
public float y;
private float alpha;
private float X;
private float Y;
private float mult = 0.005f;
void Update () {
alpha += 10;
float multed = alpha * mult;
X = x + (a * Mathf.Cos(multed));
Y = y + (b * Mathf.Sin(multed));
this.gameObject.transform.position = new Vector3(X, 0, Y);
}
// Use this for initialization
void Start () {
}
}
However, the results were a very equalized elliptical orbit (not very Newtonian-like).
RotateAround is too round for this project.
Should I be searching for a sat tracking script and adapt from there? I'm still digging, but being able to showcase 67 moon orbits around: amazing right?
UPDATE: While I don't know all the data for Jupiter's moons, I'll focus on what we DO know first, returning to physics and the Galilean moons. That's a better start. More updates if/as they happen.
Comment