public void UpdateMatrices()
        {
            if (graphic == null || graphic.canvas == null)
            {
                return;
            }

            var canvasTransform = helper?.CachedCanvas == null ? graphic.canvas.transform : helper.CachedCanvas.transform;

            var transformWorldToLocal = transform.worldToLocalMatrix;
            var transformLocalToWorld = transform.localToWorldMatrix;
            var canvasWorldToLocal    = canvasTransform.worldToLocalMatrix;
            var canvasLocalToWorld    = canvasTransform.localToWorldMatrix;

            canvasToLocalMatrix = MatrixUtils.FastMultiplication(ref transformWorldToLocal, ref canvasLocalToWorld);
            localToCanvasMatrix = MatrixUtils.FastMultiplication(ref canvasWorldToLocal, ref transformLocalToWorld);
        }
Example #2
0
        public void UpdateMatrices()
        {
            if (canvas == null || m_rectTransform == null)
            {
                return;
            }

            var canvasTransform = curvedHelper?.CachedCanvas == null ? canvas.transform : curvedHelper.CachedCanvas.transform;

            var transformWorldToLocal = m_rectTransform.worldToLocalMatrix;
            var transformLocalToWorld = m_rectTransform.localToWorldMatrix;
            var canvasWorldToLocal    = canvasTransform.worldToLocalMatrix;
            var canvasLocalToWorld    = canvasTransform.localToWorldMatrix;

            canvasToLocalMatrix = MatrixUtils.FastMultiplication(ref transformWorldToLocal, ref canvasLocalToWorld);
            localToCanvasMatrix = MatrixUtils.FastMultiplication(ref canvasWorldToLocal, ref transformLocalToWorld);
        }