This is my first post on the forums, but I would love some help with setting up a dynamic orbiting system with the 'physics' behaviour. I've looked at a heap of different topics on the forums relating to orbit, but alas, as yet I am yet to fix my problem. Basically, I want the user to be able to drag and drop (using the plugin) a 'planet' and have it automatically fall into a perfect circular orbit of a 'sun' (both objects).
As my project currently stands, I am using events to specify that as soon as the planet is 'dropped' onto the layout, a force is enacted upon it pushing it towards the sun (to simulate gravity) using a relative formula that says force = distance(planet.X,planet.Y,Sun.X,Sun.Y)/100. This works fine, because the further away the object is, the weaker the 'gravity' is.
I also have it set up so that when the planet is dropped, there is a physics impulse striking it at angle(Planet.x,planet.Y,Sun.X,Sun.Y), which means that wherever the planet is placed, it begins an anti-clockwise rotation. Again, this works as planned.
My issue lies entirely with the force of impulse itself. At the moment I get irregular elliptical orbits depending on how far the planet is from the sun, which makes me assume that the 'force' of the impulse will need to be relative to the distance between the planet and the sun, however as to the formula for the force, I am clueless.
Thank you so much in advance for any help anyone can give!