Example #1
0
    // PRIVATE METHODS

    void UpdateMatrix(ref Matrix4x4 matrix, Rect rect, float rotation, Vector2 scale, float depth)
    {
        // update rotation
        Vector3 r = Mathfx.Matrix_GetEulerAngles(matrix);

        r.z = rotation * Mathf.Deg2Rad;
        Mathfx.Matrix_SetEulerAngles(ref matrix, r);

        // update position
        Vector3 p = new Vector3(0.0f, 0.0f, depth);

        p.x = rect.x + _xOffset;
        p.y = (int)ZeroLocation * (-(rect.y - rect.height * 0.5f) + (_yOffset - rect.height * 0.5f));
        Mathfx.Matrix_SetPos(ref matrix, p);

        // update scale
        Vector3 s = Mathfx.Matrix_GetScale(matrix);

        s.x *= scale.x;
        s.y *= scale.y;
        Mathfx.Matrix_SetScale(ref matrix, s);
    }