[LEFT]Hello,
I am creating a project but I found some problems using the trigonometry…
This is the script that I done:
/* First of all: I have two rectangles (rect_mc e rect2_mc) with identical dimensions and “rect2_mc” is in “rect1_mc”.
At the start rect_mc coincides with rect2_mc.
In rect2_mc, that is in rect_mc, is present a point “punto_mc”
The initial state is given from the firsts four lines…
--------The problem is found the trigonometry formulas for let the point “blu_mc”, in level 0, coincide with “punto_mc”-------*/
rect_mc._rotation = 30;
rect_mc.rect2_mc._rotation = 20;
rect_mc._xscale = 30;
rect_mc._yscale = 80;
var Xscale:Number = rect_mc._xscale/100;
var Yscale:Number = rect_mc._yscale/100;
var rapportoScale:Number=Yscale/Xscale
var Px:Number = rect_mc.rect2_mc.punto_mc._x
var Py:Number = rect_mc.rect2_mc.punto_mc._y
var rotation:Number = rect_mc._rotationMath.PI/180;
var rotation2:Number = rect_mc.rect2_mc._rotationMath.PI/180;
var d:Number = Math.sqrt(Math.pow(Px, 2)+Math.pow(Py, 2));
var alfa:Number = Math.atan2(Py,Px);
var xFin = dXscaleMath.cos(alfa+rotation+rotation2);
var yFin = dYscaleMath.sin(alfa+rotation+rotation2);
blu_mc._x = rect_mc._x+xFin
blu_mc._y = rect_mc._y+yFin
All works if the scale in x is identical with scale in y or when i don’t rotate “rect_mc”…
Help me please!!!
[/LEFT]