Exemplo n.º 1
0
        public static void reTranslateRelative(Com.Brashmonkey.Spriter.objects.SpriterAbstractObject
			 parent, float x, float y, Com.Brashmonkey.Spriter.objects.SpriterAbstractObject
			 target)
        {
            target.setAngle(target.getAngle() - parent.getAngle());
            target.setScaleX(target.getScaleX() / parent.getScaleX());
            target.setScaleY(target.getScaleY() / parent.getScaleY());
            float xx = x - parent.getX();
            float yy = y - parent.getY();
            double angle = DegreeToRadian(parent.getAngle());
            float Cos = (float)System.Math.Cos(angle);
            float Sin = (float)System.Math.Sin(angle);
            float newX = yy * Sin + xx * Cos;
            float newY = yy * Cos - xx * Sin;
            target.setX(newX / parent.getScaleX());
            target.setY(newY / parent.getScaleY());
        }