i can´t figure out whats wrong
i´m trying to rotate an object about the origin(x=0, y=0).
to manage that i first tried to calculate the next x and the y coordinate for my object to move to.
NOTE: it´s only for one quadrant (where x and y are positive)!
i get a completely different result when i calculate it with my pocket calculator.Code:onClipEvent(load){ // init movingDegree=2; _x=50; _y=100; } onClipEvent(enterFrame){ // calculating radius and angle referring to my origin a = Number(_x); b = Number(_y); r = Math.sqrt((a*a)+(b*b)); Angle = Math.atan(b/a)*180/Math.PI; // works great so far // now i´m increasing the angle (2 degrees) // ... and calculate adjacent leg (nextX) and the opposite leg(nextY) that are the coordinates of my next point at the same time nextAngle = Number(Angle+movingDegree); nextX=Number(Math.cos(nextAngle)*r); nextY=Number(Math.sin(nextAngle)*r); }
i don´t get it.
the file is attached.
thankful for any help,
k.





Reply With Quote