Well, I think I got the angle out as:
Y=90-objectangle+atan((z1-z2)/(x1-x2))
But having tried to put the whole thing into code (below), I can't get it working - mind you, I haven't done a degrees to radians conversion. But anyway, I think I'm giving up for the moment. I hope you have better luck Zoko.
sync on
autocam off
randomize timer()
make object box 1,2,2,10
make object sphere 2,2
position camera 0,50,-200
a#=0.002 `acceleration
aa#=0.02 `angular acceleration
ang#=rnd(360) `real angle of object
maxv#=3.0 `max velocity
maxw#=3.0 `max angular velocity
v#=rnd(30)/10 `velocity
w#=rnd(30)/10 `angular velocity
position object 1,rnd(200)-100,0,rnd(100) `initial settings
turn object right 1,ang#
do
d#=abs (find_distance(object position x(1),object position y(1),object position z(1),object position x(2),object position y(2), object position z(2)))
Y#=abs (find_angle(object position z(1),object position z(2),object position x(1),object position x(2)))
RV#=abs(d#*w#/(2*sin(Y#))) `calculate required velocity
print "angle between path and target (Y#): ",Y#
print "required speed (RV#): ",RV#
print "actual speed (v#): ",v#
print "Real angle (ang#): ",ang#
print "dist from object to target (d#): ",d#
`turn towards target
if Y#>0
turn object left 1,w#
ang#=(ang#+w#) `update real angle
endif
if Y#<0
turn object right 1,w#
ang#=(ang#-w#) `update real angle
endif
`set new velocity
if v#<0 then v#=0 `make sure object goes forwards
if (v#)>RV# and (v#)>0 `if velocity is more than required velocity
v#=v#-a# `then decrease it
if w#<wmax# then w#=w#+aa# `and tighten turn
endif
if (v#)<RV# `if v is less than required v
v#=v#+a# `then increase v
if w#>0 then w#=w#-aa# `and reduce tightness of turn
endif
`move object by velocity amount
move object 1,v#
sync
loop
`find distance between two coordinates
function find_distance(x1#,y1#,z1#,x2#,y2#,z2#)
distance#=(((x2#-x1#)^2)+((y2#-y1#)^2)+((z2#-z1#)^2))^(0.5)
endfunction distance#
`find angle between object's direction and target's position
function find_angle(z1#,z2#,x1#,x2#)
angle#=90-ang#+atan((z1#-z2#)/(x1#-x2#))
endfunction angle#