[quote author=Kr2z link=topic=398.msg4219#msg4219 date=1241442290]
hello, so I have run into a little bit of trouble. I was creating newtons cannon in excel and it dose not work as supposed to. What happens is a very powerful slingshot effect. It will stay on orbit for a while, but eventually it will fly away.
my code looks like that. maa - earth ; kuul-bullet ; v-velocity
Because it is still in a test phase, I have left out some constants that do not change the orbits shape.
x0 = maa.Left + maa.Width / 2
y0 = maa.Top + maa.Height / 2
m = Sheets("nwkahur").Range("a2").Value
// input speed
vx = Sheets("nwkahur").Range("A1").Value
vy = 0
x = x0 - kuul.Left + kuul.Width / 2
y = y0 - kuul.Top + kuul.Height / 2
r = (x ^ 2 + y ^ 2) ^ (1 / 2)
kuul.Left = kuul.Left + vx
kuul.Top = kuul.Top + vy
vx = vx + m / (r ^ 3) * x
vy = vy + m / (r ^ 3) * y
I can understand that the problem is in calculations but, I cant but my finger on it. I would be very grateful, if you could help.
I wrote a similar code as urs and i think i am just as you stuck at the middle :)