-
Angle calculation but a different approach
Calculating the angle between the diagonal axis and the bottom line of the stage...
Please check this link which directs to another forum with the related question.
http://board.flashkit.com/board/show...23#post4048223
-
Senior Member
angleCalc = Stage.width / Stage.height;
myRatio = 1/angleCalc;
realAngle = -(90-(myRatio * 90) / 1);
nice try, I loved the way you tried to solve the problem, but it's just not the way it works.
It goes like this: there are magical "sine" and "cosine" functions. They take angles and return values that correspond to linear coordinates in some way. There is "tangent" function defined as a ratio between sine and cosine (and so the ration between corresponding x and y values). Finally, there is inverse function called "arctangent" that takes ratio of x and y values and returns corresponding angle. You should learn about all of them 1st before scripting anything.
But, of course, if you just want to take a shortcut, it is there, too.
-
hi realMakc,
first of all thanks for your response... Actually i was aware of those things that you mentioned above... like sine, cosine, tangent and so... and that was the first and noobish attempt that i've written there... after doing some search about radians, angles, and Math.atan2 I found examples like you posted in the link. Strangely they didn't work for me but the code that you provided with that link seems to work just as i want...
THANK YOU
case closed.
P.S. how do members edit their thread and put a " [RESOLVED] " text in the header?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|