Found this nifty function
by Kevin Epps · in Torque Game Builder · 08/14/2008 (9:45 am) · 0 replies
I'm sure a lot of you already have this, but I had to search far a while for a function like this.
Finding the direction and angle from one point to another:
I found that here:
Here
Finding the direction and angle from one point to another:
// this function marely calculates direction-angle between two points
function calculateAngle(%Y1, %Y2)
{
%X1 = getWord(%Y1,0);
%Y1 = getWord(%Y1,1);
%X2 = getWord(%Y2,0);
%Y2 = getWord(%Y2,1);
%X1 = %X2 - %X1;
%Y1 = %Y1 - %Y2;
%angle = mRadToDeg( mAtan( %X1, %Y1 ));
return %angle;
}I found that here:
Here