ok i work months on this.
and i think this code will be very helpful to many poeple.
least till wofe make the newer version of his ezrotate.
this requires no plug'ins
what is does is it give the compass direction of an object
and the pitch angle of the object compared to gruond(global)
and the roll angle of the object compare to gruond(gloabal)
with this you can make a compass. know how much climb a car is driven up a hill. if a tank is leaning on a hill and is about to roll over. hud data for a airplane. endless options, i hope this is usefull
ok specal thanks to Spooky,Lost in Thought ,Andy Igoe, and zircher
they are the ones that cracked the idea how this is done.
oh maybe froogle i think he did something, just can't remember..
rem need these declared first
type anglemath
angy as float
angx as float
angz as float
endtype
global math as anglemath
rem need this made, adjust object number as needed
make object sphere 400,10
hide object 400
rem now the function.....
rem first is the main object the need the directions read
rem second is the object made abuove that is hiden
function getang(first,second)
position object second, object position x(first),object position y(first),object position z(first)
move object second,10
math.angy = wrapvalue(atanfull(object position x(second)-object position x(first),object position z(second)-object position z(first)))
math.angx =wrapvalue(atanfull(object position y(second)-object position y(first),object position Z(second)-object position Z(first)))
if math.angy > 90 and math.angy < 270 then math.angx = wrapvalue(360 -math.angx - 180)
if math.angx > 180 then math.angx = math.angx-360
move object second,-10
move object right second,10
math.angz = wrapvalue(atanfull(object position y(second)-object position y(first),object position x(second)-object position x(first)))
if math.angy > 90 and math.angy < 270 then math.angz = wrapvalue(360 -math.angz - 180)
if math.angz > 180 then math.angz = math.angz-360
endfunction
rem output will be :
rem math.angx direction as in the compass on the map
rem math.angy direction that the object nose is facen up or down from lvl gruond
rem math.angz direction that the object is rolled left or right compare to gruond lvl