2D Planet Orbit

If you just need the object to circle around without any physical correctness use sine and cosine:



x = sin(t)*radius + center.location.x;
y = cos(t)*radius + center.location.y;


where t is a continous time variable in the range of [0,2PI]

If you want to take velocity etc into account,

add the difference vector between your object and the oribtting object to the orbitting object’s velocty;



Object a; //Orbitting Object
Object b;

a.velocity += b.location - a.location;


if you need 2d, just remove a dimension.