Set objects in orbit

Greettings fellas!

I need some maths help here! When generating planets in stellar systems, I used empties that where animated for the orbits. However, the type of planet depends on the distance the planet is from the star, meaning that the easy way would produce the same planets for the same type of star. Also all these planets would be aligned the same way, and there would be a few animations running full time.

The solution or second option, is to give a random (calculated) position for the planets and establish their period according with time. Meaning that the planet revolution around the star will be the result of the star seed, the planet distance and the general time. I guess some trigonometry has to be used…
I can get the planet at a certain distance, but can’t make them orbit. Here 's a simplified example.

Appreciate your assistance!

Hi torakunsama,

I setup solar systems like this:

  • empties to represent the centers of stellar objects (sun/planet/moon)
  • parented together to for the systems hierarchy
  • each empty gets a rotation action to perform the orbitting animation
  • parent visible models to the empties to represent the stellar objects
  • play rotation actions to perform the individual rotations

no complex math needed.

See the mouse orbiter demo for an example.

Yes, that’s how I was doing till now. Only, you get these giant stars that can’t possibly have the planets in the same position as the smaller stars. And there might be an incredible number of moons and planets in one system. To set this by hand, I must set a limit of moons per planet, the moons orbits can’t be arbitrary, because of the planet variable size.
What I can have is to add a speed to the planet and then have the an empty track to the center of the system!
So an orientAxisTo function can be used and a motion function can be used to move the planet. That’s a start!
Then remains the orbital position at any given time…

You can randomly place the moon/planet some where in the space. Then parent it to the according “rotator”. The orbit radius will be the distance of the planet to the “rotator” at the time of parenting.

In the attached example, drawn from your original file, the rotation speeds are set manually, but they could be set randomly, or even made dependant upon the mass of the planets.
orbit_temp.blend (431 KB)

A single player game with actual size planets using the add object actuator and distance constraint would be better in my opinion so that anyone can make a game like that.They could be just untextured bent planes and the videogame designer could put the textures on them plants ,buildings,enemies and vehicles on them.Of course it should have gravity .Such a system should be included in blender as a add on and also should work with the steering actuators and pathnodes.More people would use blender.

Thank you all for your participation.
I also came up with a solution and was counting on using the planetary orbiting on each planet(individually). The file is this one.
@mb10: That was what I was looking for originally. I’ll still use you trigonometry to get the planets to orbit around stars and moons around planets.

@3d solar system builder: Creating planets in a game is not the hardest part of such a game. If you can get a good algorithm to calculate quickly(like in an external application) you could create procedural planets a la Infinity. Having a convincing and interesting game play in such a level is the hardest part.
For example, Geist 3D was supposed to be that kind of game engine. By the press of a button, you could have a planet, complete with ocean, atmosphere and vegetation. But, it required a robust GPU and CPU to render the planets, also the engine was built with full size planets in mind. Blender is an animations studio suite with a built in Game engine, not the other way around! More people are not using the BGE, because of some limitations and lack of publicity.

Thank you for you participation!

Why cant you animate a bent plane to act like it is part of a actual sized planet.I know it would be hard but is it possible?

This is what I’m doing!
The planet is divided in 24 parts. Then I record the altitudes from the planar mesh, then I save that data in a file. Later I project this map onto a spherified plane. By combining various maps, I can get unique planets with believable features.
So on the stellar system scene, the planet has it’s 24 sections, when the player reference object is at a certain distance of that section, an instance is loaded in the planetary scene, then the player can interact with the terrain. Planets can be 8 times bigger than the previous ones in my videos.

I would have done some math, as I am taking a physics course at the moment…
I think your way is better.

The maths would give more accuracy, and maybe even more detail! However, it would cost you on speed! My tests have proven that it’s easier/faster to read the data than process it and apply to the vertices. Also I can use the map data to place objects on the surface, like vegetation, rocks, fauna nests, etc.
The code I used is a about 6-10 lines long. For more detail, I can overlay another map on a different scale, for close-up elevation.