Beispiel #1
0
        protected override Vector3 _ModifyOffset(VertexData vertexData)
        {
            /* READ ME OR REMOVE ME
             *
             * This method receices the position and normal of a vertice.
             * Whatever Vector3 is returned will be the new position of the vertice.
             *
             *
             * For example, the line below randomly moves the vertice.
             *
             * basePosition += new Vector3 (Random.Range (-0.1f, 0.1f), Random.Range (-0.1f, 0.1f), Random.Range (-0.1f, 0.1f));
             *
             *
             * You also have access to the ModifierObject, which handles this modifier along with any other ones attached to the same GameObject.
             * From there you can info you might need.
             *
             * For example, Time.time doesn't work very well when calculations need to take place over multiple frames. If you want a value to animate over time, use modObject.Time!
             *
             */

            // Return an unmodified vertice.
            return(vertexData.position);
        }
Beispiel #2
0
        protected override Vector3 _ModifyOffset(VertexData vertexData)
        {
            var   position = vertexData.position;
            float angle, cos, sin;

            switch (axis)
            {
            case Axis.X:
                angle      = position.x * twistAmount;
                angle     *= strengthCurve.Evaluate(Mathf.InverseLerp(-bounds.extents.x, bounds.extents.x, position.x));
                cos        = Mathf.Cos(angle);
                sin        = Mathf.Sin(angle);
                position.z = position.z * cos - position.y * sin;
                position.y = position.y * cos + position.z * sin;
                break;

            case Axis.Y:
                angle      = position.y * twistAmount;
                angle     *= strengthCurve.Evaluate(Mathf.InverseLerp(-bounds.extents.y, bounds.extents.y, position.y));
                cos        = Mathf.Cos(angle);
                sin        = Mathf.Sin(angle);
                position.x = position.x * cos - position.z * sin;
                position.z = position.z * cos + position.x * sin;
                break;

            case Axis.Z:
                angle      = position.z * twistAmount;
                angle     *= strengthCurve.Evaluate(Mathf.InverseLerp(-bounds.extents.z, bounds.extents.z, position.z));
                cos        = Mathf.Cos(angle);
                sin        = Mathf.Sin(angle);
                position.x = position.x * cos - position.y * sin;
                position.y = position.y * cos + position.x * sin;
                break;
            }
            return(position);
        }
Beispiel #3
0
 protected override Vector3 _ModifyOffset(VertexData vertexData)
 {
     return(Vector3.Lerp(vertexData.position, vertexData.position.normalized * radius, amount));
 }
 protected abstract Vector3 _ModifyOffset(VertexData vertexData);
 public Vector3 ModifyOffset(VertexData vertexData)
 {
     return(update ? _ModifyOffset(vertexData) : vertexData.position);
 }
Beispiel #6
0
 protected override Vector3 _ModifyOffset(VertexData vertexData)
 {
     return(vertexData.position + ((Vector3)vertexData.tangent * amount));
 }
Beispiel #7
0
        protected override Vector3 _ModifyOffset(VertexData vertexData)
        {
            var position = vertexData.position /= nearestAmount;

            return(new Vector3(Mathf.Round(position.x), Mathf.Round(position.y), Mathf.Round(position.z)) * nearestAmount);
        }
Beispiel #8
0
 protected override Vector3 _ModifyOffset(VertexData vertexData)
 {
     return(vertexData.position + vertexData.normal * amount);
 }
Beispiel #9
0
 protected override Vector3 _ModifyOffset(VertexData vertexData)
 {
     vertexData.position = matrix.MultiplyPoint3x4(vertexData.position);
     return(vertexData.position);
 }
 protected override Vector3 _ModifyOffset(VertexData vertexData)
 {
     return(transformSpace.MultiplyPoint3x4(vertexData.position));
 }