- Home /
How to create multiple orbital paths around a sphere dynamically in Unity
I'm creating a atom simulator kind of project. So what I am currently doing is from the periodic table when user clicks on any of the element, I will spawn a sphere gameobject (i.e atom) for that element. Now as atoms have electrons with different shell configuration around them. I am trying to simulate that effect. I am able to create a single orbital path around the sphere(atom) and spawned an electron sphere which rotates around the atom nicely.
Here is what it looks like
I am doing this using the following code.
// Update is called once per frame
void Update () {
//transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
transform.RotateAround(rotateAround.position, Vector3.forward, rotationSpeed);
}
Now I am trying to have multiple orbital path around atom(like n shell, p shell etc). I tried adding some offset to the transform that is passed in the rotate around method, but then the path was not completely circular.
So how can I create something like that.