;

PDA

Click to See Complete Forum and Search --> : angle between 2 points


hmvince
07-04-2009, 01:48 AM
i know this is simple but i just need the simplest code to find the angle between 2 points in flash 8.
thankyou all.

WPRS
07-04-2009, 08:58 AM
Hi hmvince,

I've found a tutorial from Jim Bumgardner:

http://www.flashkit.com/tutorials/Math-Physics/Changing-Jim_Bumg-1014/index.php

hmvince
07-04-2009, 06:47 PM
thankyou WPRS
i was also wondering in what direction is 0, 90, 180, and 270 in flash because i know that it is different to other programs but still unsure.
thanks again

WPRS
07-04-2009, 07:03 PM
You are welcome :)

hmvince
07-05-2009, 02:57 AM
did you know about the angles?

WPRS
07-05-2009, 07:05 AM
function GetAngles (Direction1)
{
var Direction2:Number = Direction1 % 360;

if ( Direction2 <= 180 )
{
return ( Direction2 );
}
else
{
return ( -( Direction2 - 180 ) );
}
}

trace (GetAngles (0));
trace (GetAngles (90));
trace (GetAngles (180));
trace (GetAngles (270));

hmvince
07-06-2009, 04:15 AM
this is not really what i meant.
is 270 degrees to the right?
is 90 degrees to the left?
is 0 degrees to the up?
is 180 degrees to the down?
excuse my english

WPRS
07-06-2009, 08:32 AM
http://geniusduck.tistory.com/tag/angle

http://cfs8.tistory.com/image/4/tistory/2008/07/11/16/29/48770bee5a069


var radians = degrees * Math.PI / 180
var degrees = radians * 180 / Math.PI

hmvince
07-06-2009, 08:47 PM
this isnt in flash though is it. because i heard once that the angles in flash are different, like rotated clockwise or something?