Making something orbit an object using physics is not hard. I have used and found many ways to do it. So Why is calculating the necessary orbit speed at a specific distance hard?

I want to create and obj1 sprite, apply physics and center it on screen. Then create an obj2 (with physics) at a random distance from obj1 and send it into orbit at a precise speed to keep it in a circular orbit.

There has to be a way to do this� I have a capx using the gravity plug-in to use as an example, but you may want to do it a different way. (like using xvector variables and mass, ect�)

I know the math behind this, but it just does not seem to work. Anyone want to take a crack at it with me?

Unless you need Physics for another part of your game why not just use an offset "pivot point" at your sun ?

Could you also post a picture of the event sheet showing the maths (I can't open the capx because I don't have the plugin required) for me to have a play with.

I finally got around to looking for a solution to this. The formula for the initial velocity from wikipedia is:

v=sqrt(G*M/r)

where G is the gravitational constant, M is the mass of the object being orbited and r is the distance. Since we aren't dealing with real distances we can just use 1 instead of G.

In my tests I didn't use the gravitation plugin, instead I just applied a gravitational force to the planet every tick:

R0J0hound, you are a great tribute to all those who frequent this site. Thank you for taking the time to solve this. That extra 48.8 is the key. Thanks for figuring that out! I have created a simple capx with comments to help anyone else in the future who may try to do this.

This IS using the physics engine to orbit a moon/satellite around a central object with mass. The formula uses the internal Physics.mass of the objects, which is calculated by collision box size*Density variable in the physics properties. So the bigger the item, the more mass it has, multiplied by as many times you want by changing the Density property of sprite.physics.density. These objects can be made to interact with other physics objects creating somewhat realistic planetary models.

Not only the formula for gravity, but specifically the important impulse push to get the object into orbit.

I forgot to change the collision mask in the physics of each item to CIRCLE - not bounding box... That helps the orbit calculation a bit - so try it with that setting to see how it changes the movement... (The mass calculation will changes a bit, causing the calculations to change.)