Exemple #1
0
        public void ResetPoints()
        {
            if (VertexExposers == null || VertexExposers.Count == 0)
            {
                return;
            }

            ResetVertexData();
            SetSizeAndPositionFromSpriteRendererBounds();

            var pos = transform.position;

            var halfXSize = _size.x / 2f;
            var halfYSize = _size.y / 2f;

            var partX   = _size.x / (float)(_ControlPoints - 1);
            var partY   = _size.y / (float)(_ControlPoints - 1);
            var topLeft = pos + new Vector3(-halfXSize, halfYSize);

            for (int x = 0; x < _ControlPoints; x++)
            {
                for (int y = 0; y < _ControlPoints; y++)
                {
                    var position = topLeft + new Vector3(x * partX, -y * partY);
                    _sortedDeformationPoints[x, y] =
                        new GridDeformationPoint(position, transform, x, (_ControlPoints - 1) - y, this);
                }
            }
        }
 public GridDeformationPointWeightData(GridDeformationPoint point)
 {
     Point = point;
 }