ActionScript 3.0 :: Angles: Converting Degrees And Radians?
Aug 9, 2009
I am currently learning some trigonometry tome with my actionscript...In AS I am aware that angles need to be converted from degrees to radians to use certain Math properties, such as Math.sin...etcHere is my code to convert degrees to radians...
ActionScript Code:
var degrees:Number = 90;
var radians:Number = degrees * Math.PI / 180;
I have a program which must convert degrees to radians every frame and use this value to change a variable. After a while, I notice that the variable becomes way different than what it should be, because of the slight inaccuracy when converting degrees to radians (I multiply to value by pi/180). I was wondering if there is a more accurate way to convert or maybe a way to use Math.cos() and Math.sin() with degrees.
In the swf I simply moved the mouse around the stationary object marker and read the results. For some reason I'm getting crazy values like -20 and 18. Why on earth is that? I thought radians in flash had a range between -PI and PI.
I have an object that rotates based on the mouse positionand I'm trying to count the degrees as it rotates.for example if i rotate 200 degrees cww the degree measurement is 200if i will rotate another 350 degrees cww the degree measurement will be 550now if i rotate 150 cw the measurement will be 400 now.I have this code: (it counts radians, but it is the same idea)p1 = mouse position
What I've done so far is using your mouse you (click & release) you shoot a ball off in that direction using radians. Now what I'd like to happen is when the ball hits the wall it bounces off in it's reflection angle. Eg. if the ball hits the right-hand-side wall travelling at in a radians of -0.65 it should bounce back in the radians of about -2.5
The idea is simple enough but I feel as if I've been running in circles trying to figure this out. I need to get the polar angle between two objects. One object is stationary (the item) and the other moves around (the character). I need the polar angle to the item from the character. Basically the 0,0 of the polar angle will be the character's x,y.
I am trying to create a wheel of fortune with dyanamic values being inserted into it. Is there any way to have dynamic values to be at angles. When ever I turn them a little bit, they dont' seem to show up any more.
best method to calculate the angles of a triangle? Or have any good references? I have 3 points which can be moved when the user drags on it, so the angles will have to change accordingly.
I am trying to create a wheel of fortune with dyanamic values being inserted into it. Is there any way to have dynamic values to be at angles. When ever I turn them a little bit, they dont' seem to show up any more.
This client of wants a flash video player of a model, modeling some clothes.
They are going to set up 3 different cameras around her at the same time filming her - one from the front, one from the side and one from the back. Each clip lasts exactly 3mins and they are filming her at THE SAME TIME.
Now after this, they want to put a FLASHPLAYER on their website with the video playing in a screen with 3 buttons underneath one saying FRONT VIEW, one saying SIDE VIEW AND one saying BACK VIEW. The three separate videos will be integrated in some way with this one flash file.
The video player might start playing the FRONT VIEW first.
BUT lets say 30 seconds into the clip I press the SIDE VIEW button the video switches to the side view on 30 seconds - The side view video doesn't play right from the start. Like I said before for example if the person is speaking and says "hello there", if you switch angle by clicking one of the buttons just at the point after she has said the word "hello", you switch to the angle where he is just about to say "there". If you see what I mean.
As I said before there are 3 separate video clips:- FRONT VIEW, SIDE VIEW and BACK VIEW. Now I am not sure if these have to be embedded in the FLA file or can be contained in a separate folder on the server so that the SWF can access them. I am worry about streaming over the internet thats why I THINK Flash Media Server3 MIGHT be a solution BUT I don't know. BUT they must be seamless.
AGAIN to reiterate...LETS say I am watching the SIDE view 30 seconds after the clip has started and the model starts scatching her head and then AT THAT POINT I click the front view button below I see the model scratching her head from the front view at THAT precise moment.
So all the videos seem to work at the same time to the casual viewer/user and it looks as though you are just switching views whenever you want.
I have been looking all over the net to see if someone has produced a working example or if there is a tutorial somewhere but I have found NOTHING.
I think there might be a problem pulling this one off as each video clip could be 4-5 MB in size and if they are streaming then there would be download problems and these videos might stop due to people with various bandwidth restrictions UNLESS all the videos were integrated into the flash library and were referenced from within by Actionscript but then the resultant SWF could be HUGE.
getting angles, of two movieclips that are on my stage. With instance names: circle1,circle2. I read that I should use the function Math.atan2 to get the angle, in radians, then I convert it to degrees, but it doesn't make sense, the angles aren't correct.. Here I paste the code I use (its AS not PHP don't know how to add the AS tags):
I have a draggable movie clip with another movie inside that. On the click of a button I need it to be at 0,0. This works fine but I also need to rotate the draggable movie clip and when I attempt to move the child movie to 0,0 it goes of the screen.
anyone have a hint how to create with AS, leader dots? Meaning, I need to connect two points with growing leader dots that may change direction at right angles.
I am trying to rotate this text 90 degrees. I've read that you're supposed to embed the text....and I've tried that and the text just vanishes. I've also tried to set my own text format, but the problem persists.
Code: var tf:TextFormat = new TextFormat(); tf.font = "Verdana14B"; tf.size = 14;[code]...........
i'm not quite sure which forum to use, so therefore I post this discussion here. I want to animate an object that is turning 360 degrees around.
[Code]...
It does'nt need any navigation like this example, but it's going to just an animationmovie.This animation is going to be viewed on a widescreen tv. How do I make the animation fit the screen? I'm not sure which resolution the animation must be. I guess this has to match the resolution of the tv. But is it just as simple as changing the flash file settings in 1920 x 1080?
I want to scroll these image 360 degrees. Right now i can go end to end but it will not recylcle the image. Is there any code out there that will do this? How would i fix the code i have to accomplish this? Working swf file [URL] Source code link [URL]
I am rotating an object by incrementing in 90 degrees,however after 180degrees it rotates to -90...then it can't quite make it's mind up if it should go to -180, or 0, which should be the same thing? (except it messes up my if statements down the line)(by that I mean, sometimes it will go back to 0, and sometimes it will switch to -180??)Where is 270, and for that case, 360?
I'm having trouble with this mainly because Flash's Math.atan() doesn't give the same results as my TI-83's tan^-1 function.
If I have a line with a positive rise and run for the slope and use tan^-1( (the slope) ) on my calculator, I get a value between 0 and 90, with 0 being a horizontal line and 90 a vertical line. A negative numerator with a negative denominator for the slope puts it in quadrant 4 where tan^-1(slope) gives 0 to -90 values, again with 0 being horizontal and -90 being vertical.
Putting the slope of the blue line into tan^-1() would give a value of about 80 degrees, while the red line would calculate to about -50 degrees. The rotation property Flash uses rotates objects clockwise and can range from 0-360. Using the -90 to 90 values and figuring out if the rise and run of the slope are positive or negative, I can determine which quadrant the line is in and calculate the degrees.
However, this so far is not possible for me because Math.atan() gives odd results.
A practical application for this knowledge would be a player in a game throwing spears from (0,0) to the mouse x,y. The slope would take care of the trajectory of the spears, however if your spear sprite is a spear flat and facing toward the right, you need to rotate it appropriately from 0-360.
I need to get a certain object to rotate by set degrees (my navigation for this project is organized on a wheel--6 sections on the wheel), and I would like to have buttons that tell this object to smoothly rotate by set degrees (intervals of 60 degrees in this case).
What I have in mind are 5 buttons that control the rotation: 1. 120 deg. ClockWise 2. 60 CW 3. 60 CCW 4. 120 CCW 5. 180 CCW