Could it be that m1 and m2 refer to the same actor? If the length is 0, then both xdiff and ydiff had to be 0. Perhaps one of m1 or m2 is 0, so the activator will be used, and the activator actually has a tid set, which the other argument happens to be. It could also be that either m1 nor m2 exist, so (0, 0, 0) is returned for all GetActorXYZ calls.
Edit: Since zdiff appears to be not 0, m1 and m2 being the same actor should not be the case.
It would be helpful if you posted the script this function is called from, described the setup of the things and who runs the script.
The above (and the scalar property of VectorAngle I attempt to demonstrate further down) should explain why you get only one of two values, likely depending on the sign of zdiff. Since the horizontal length is 0, you get the angle of a vector lying on the z-axis, and that should be either 0.75 or 0.25, not 0.86 or 0.25, as far as I know. If this 0.86 is not a typo, then we may have discovered something messed up, or I have a misconception here. =p
Also, I doubt the print cast type being d: changes anything here, if that possibly comes up. You could use f: to be sure, but in general, your code should have printed a rather large whole number.
There should be no need to shift the values in VectorAngle. Internally, you probably get something looking like
Code: Select all
sqrt[(xdiff * 2^-16)^2 + (ydiff * 2^-16)^2] / (zdiff * 2^-16)
which using power laws under the circumstance of a headache I simplified to:
sqrt(xdiff^2 + ydiff^2) / zdiff
using atan and setting x and y > 0, the remaining cases should be like, the same (ignoring the possibility of imprecision).
Another edit:
This open bug may be relevant.