mostly...
i managed to code it down, and just as you said, IT WORKS!
but sometimes it will give me negative values which obviously dont work. Also sometimes it gives me quite normal values which dont work???
i dont seem to be allowed to attach .exes nor .rar files?
well here is a download link for a .rar containing a test app that i made. HERE
leftclick to place the shooter, press space to "drive" the target forward, press enter to shoot and press space to return from shooting.
the value in the topleft corner is the value of t after 25 iterations of the Newton rahson method. i tried others but 25 seemed to be fine and very accurate for this quick test. ( 4 wasnt accurate enough)
oh and the litle white dot is where you should aim ( with the mouse)
the code of the newton calculation :
a# = rx#-x2# : b# = ry#-y2# : p# = pi()
v1# = 2*a#*h#*r# : v2# = 2*b#*h#*r# : v3# = -2*v#^2 : v4# = r#^2+a#^2+b#^2 : v5# = r#*2*b# : v6# = r#*2*a# : t0# = sqrt((x1#-x2#)^2+(y1#-y2#)^2)/v#
for i = 1 to 25
t0# = t0# - (v4#-t0#^2*v#^2+v5#*cos(h#*t0#+g#)+v6#*sin(h#*t0#+g#))/(v1#*cos(h#*t0#+g#)-v2#*sin(h#*t0#+g#)-v3#*t0#)
next
its DarkBasic code. might be quite unclear as it is so stacked.
rx#,ry# = coordinates of the center of the targets "circle"
x2#,y2# = coordinates of the shooter
h# = turnrate of target
r# = radius
v# = velocity
x1#,y1# = coordinates of target
g# = radiuss initial angle
t0# = the value of t#
any ideas of how to avoid negative and wrong values? i would rather it gave a blank than giving wrongs ...






