Hi,
I’m stuck on this problem and I need your help, as I’m really under pressure
Imagine a situation, where you need to take a point and rotate it around some other point. I mocked up some code and I can’t find a way how to fix it.
Here is what I have now:
var center : Point = new Point ( Stage.width / 2, Stage.height / 2 );
var mouse : Point = new Point ( _xmouse, _ymouse );
function onEnterFrame ()
{
var distance : Number = Point.distance ( center, mouse );
var angle : Number = Math.acos ( ( center.x - mouse.x ) / distance );
angle *= 1.05;
mouse.x = center.x + Math.cos ( angle ) * distance;
mouse.y = center.y - Math.sin ( angle ) * distance;
pointer._x = mouse.x;
pointer._y = mouse.y;
}
And a little visual example.
All the examples I’ve found work with known angle so I had to try and implement a calculation of that angle, but nothing seems to work. It would be easy to make it only circle around the center, but it is necessary, that the movement can be influenced by other forces.
Thank you for your time,
Matthew