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
2 Answers
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)
-
$\begingroup$ Most orbits are elliptical, wouldn't this only create circular orbits? $\endgroup$ Apr 10, 2021 at 18:44
First, make a circle curve, originating from the sun, and scale so that the edge is in the centre of your planet like this.
then, add a curve modifier in your planet, and select the circle curve.
Now when you move your planet across the x axis, it orbits.
-
$\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$– user53103May 15, 2018 at 17:44
-