0
$\begingroup$

I am making a space game in BGE and I need a planet to orbit around the sun without having the origin point inside the sun (this is because I want it to have a Collision bounds). How can I do this? Thanks

$\endgroup$

2 Answers 2

3
$\begingroup$

Add a circle or any other object (could be an empty) to the position of the sun and parent the planet to it. If you rotate the center object, the planet will rotate too, you can then animate its rotation via the center object's rotation (or just let it rotate on its local axis via Motion Actuator). Its important to create a new center object for every other planet so that their rotations can be different.

Object Relations:

  • Sun
  • Orbit Object
    • Planet (Origin at sun)

Example (Circles used as orbit objects for demonstration): Example

$\endgroup$
1
  • $\begingroup$ Most orbits are elliptical, wouldn't this only create circular orbits? $\endgroup$ Apr 10, 2021 at 18:44
0
$\begingroup$

First, make a circle curve, originating from the sun, and scale so that the edge is in the centre of your planet like this. enter image description here

then, add a curve modifier in your planet, and select the circle curve. enter image description here

Now when you move your planet across the x axis, it orbits.

$\endgroup$
2
  • $\begingroup$ Thanks, but this doesn't appear to work in the game engine. It does work in the viewport, but if I run the game engine, it just moves straight. $\endgroup$
    – user53103
    May 15, 2018 at 17:44
  • $\begingroup$ Oh.... ill try to find something $\endgroup$ May 15, 2018 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy