The following code is not working as expected:
` origin point 1 point 2
print ezro_anglebetweenpoints(0, 0, 0, 0, 1, 0, 1, 1, 0), " = 45.0"
print ezro_anglebetweenpoints(0, 0, 0, 0, 1, 0, 1, 0, 0), " = 90.0"
print ezro_anglebetweenpoints(0, 0, 0, 0, 1, 0, 0, -1, 0), " = 180.0"
wait key
[edit]
I came up with this function until the bug is fixed:
function AngleBetweenPoints(fOX as float, fOY as float, fOZ as float, fP1X as float, fP1Y as float, fP1Z as float, fP2X as float, fP2Y as float, fP2Z as float)
x = make vector3(1)
x = make vector3(2)
x = make vector3(3)
set vector3 1, fOX, fOY, fOZ
set vector3 2, fP1X, fP1Y, fP1Z
set vector3 3, fP2X, fP2Y, fP2Z
x = make vector3(4)
x = make vector3(5)
subtract vector3 4, 2, 1
subtract vector3 5, 3, 1
normalize vector3 4, 4
normalize vector3 5, 5
Angle# = acos(dot product vector3(4, 5))
endfunction Angle#