Seems to work ok for me KISTech if this is the result you were after.I have used your code in a loop that repositions the object "target" at random and positions the object "dummytarget" at a fixed radius inline with it and it always seems to match up.
sync on
sync rate 60
autocam off
color backdrop 0,0
set text font "Arial"
set text size 12
set text transparent
position camera 0,200,0
point camera 0,0,0
center=1
make object cube center,5``marker for center of grid
target=2
make object cube target,5``target object
color object target,rgb(255,0,0)
position object target,rnd(100)-50,0,rnd(100)-50
dummytarget=3
make object sphere dummytarget,4``target object
color object dummytarget,rgb(0,255,0)
EZro_SetPos object position x(center),object position y(center),object position y(center)
EZro_Seteuler object angle x(center),object angle y(center),object angle z(center)
ra# = EZro_FindLocalYAngleToPoint(object position x(target),object position y(target),object position z(target))
x# = (sin(ra#) * 100)
z# = (cos(ra#) * 100)
position object dummytarget,x#,0.0,z#
do
if spacekey()
position object target,rnd(100)-50,0,rnd(100)-50
EZro_SetPos object position x(center),object position y(center),object position y(center)
EZro_Seteuler object angle x(center),object angle y(center),object angle z(center)
ra# = EZro_FindLocalYAngleToPoint(object position x(target),object position y(target),object position z(target))
x# = (sin(ra#) * 100)
z# = (cos(ra#) * 100)
position object dummytarget,x#,0.0,z#
while spacekey()
endwhile
endif
sync
loop
Im using your code with very few alterations to find the position for the "dummytarget" so i cant see why your geting strange angles returned.
Edit:
you beet me to it and posted while i was testing this.