|
|
I forgot I did this once already.
Mike
#macro vanglesXY(tVec2)
#local fSgnX = 1;
#local fSgnY = 1;
#local tPrjB1 = vnormalize(<tVec2.x, 0, tVec2.z>);
#if (tPrjB1.x != 0)
#local fSgnX = tPrjB1.x/abs(tPrjB1.x) * -1;
#end
#local tPrjB1 = <tPrjB1.x, tPrjB1.y, max(min(tPrjB1.z,1),-1)>;
#local fAngY = acosd(tPrjB1.z) * fSgnX;
#local tPrjB2 = vnormalize(vrotate(tVec2, <0, fAngY, 0>));
#if (tPrjB2.y != 0)
#local fSgnY = tPrjB2.y/abs(tPrjB2.y);
#end
#local tPrjB2 = <tPrjB2.x, tPrjB2.y, max(min(tPrjB2.z,1),-1)>;
#local fAngX = acosd(tPrjB2.z) * fSgnY;
<fAngX, (fAngY + 180) * -1, 0>
#end
Post a reply to this message
|
|