Author Topic: Text along a curve  (Read 64593 times)

christougher

  • Newbie
  • *
  • Posts: 19
Re: Text along a curve
« Reply #75 on: March 01, 2016, 09:42:29 PM »
Thanks for the speedy reply, I'd just downloaded an older version and it works. Just gotta change that it bends backwards as if it were pasted on a Cylinder...
Thx.

Edit.... Aaaand got it. :)
« Last Edit: March 01, 2016, 10:01:21 PM by christougher »

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #76 on: March 01, 2016, 10:14:52 PM »
Thanks for the speedy reply, I'd just downloaded an older version and it works. Just gotta change that it bends backwards as if it were pasted on a Cylinder...
Thx.

Edit.... Aaaand got it. :)

:)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #77 on: March 03, 2016, 03:49:34 PM »
Here is a new script which is basically an updated version of the AnimateVertexColor function part of the VertexAttributeModifier.cs script.

This new script works with Multi Font & Sprites and for either text components. This should be used as an example of how to modify the other parts of the VertexAttributeModifier.cs or to implement your own new functions.

Code: C#
  1. using UnityEngine;
  2. using System.Collections;
  3. using TMPro;
  4.  
  5. public class VertexColorCycler : MonoBehaviour {
  6.  
  7.    private TMP_Text m_TextComponent;
  8.  
  9.  
  10.    void Awake()
  11.    {
  12.        m_TextComponent = GetComponent<TMP_Text>();
  13.    }
  14.  
  15.  
  16.    void Start()
  17.    {
  18.        StartCoroutine(AnimateVertexColors());
  19.    }
  20.  
  21.  
  22.    /// <summary>
  23.    /// Method to animate vertex colors of a TMP Text object.
  24.    /// </summary>
  25.    /// <returns></returns>
  26.    IEnumerator AnimateVertexColors()
  27.    {
  28.        TMP_TextInfo textInfo = m_TextComponent.textInfo;
  29.        int currentCharacter = 0;
  30.  
  31.        Color32[] newVertexColors;
  32.        Color32 c0 = m_TextComponent.color;
  33.  
  34.        while (true)
  35.        {
  36.            int characterCount = textInfo.characterCount;
  37.  
  38.            // If No Characters then just yield and wait for some text to be added
  39.            if (characterCount == 0)
  40.            {
  41.                yield return new WaitForSeconds(0.25f);
  42.                continue;
  43.            }
  44.  
  45.            // Get the index of the material used by the current character.
  46.            int materialIndex = textInfo.characterInfo[currentCharacter].materialReferenceIndex;
  47.  
  48.            // Get the vertex colors of the mesh used by this text element (character or sprite).
  49.            newVertexColors = textInfo.meshInfo[materialIndex].colors32;
  50.  
  51.            // Get the index of the first vertex used by this text element.
  52.            int vertexIndex = textInfo.characterInfo[currentCharacter].vertexIndex;
  53.  
  54.            // Only change the vertex color if the text element is visible.
  55.            if (textInfo.characterInfo[currentCharacter].isVisible)
  56.            {
  57.                c0 = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 255);
  58.  
  59.                newVertexColors[vertexIndex + 0] = c0;
  60.                newVertexColors[vertexIndex + 1] = c0;
  61.                newVertexColors[vertexIndex + 2] = c0;
  62.                newVertexColors[vertexIndex + 3] = c0;
  63.  
  64.                // New function which pushes (all) updated vertex data to the appropriate meshes when using either the Mesh Renderer or CanvasRenderer.
  65.                m_TextComponent.UpdateVertexData();
  66.  
  67.                // This last process could be done to only update the vertex data that has changed as opposed to all of the vertex data but it would require extra steps and knowing what type of renderer is used.
  68.                // These extra steps would be a performance optimization but it is unlikely that such optimization will be necessary.
  69.            }
  70.  
  71.            currentCharacter = (currentCharacter + 1) % characterCount;
  72.  
  73.            yield return new WaitForSeconds(0.05f);
  74.        }
  75.    }
  76. }
  77.  


Raptcha911

  • Newbie
  • *
  • Posts: 2
Re: Text along a curve
« Reply #78 on: March 23, 2016, 04:20:16 AM »
Hey,
I'm new to TMP and I just updated to v 0.1.54 beta 1b, I'm trying to warp a text and found this forum looking for ways to do that.. I have the VertexAttributeModifier.cs and have added it to a TMP text object.. But somehow its not working properly, the text just vanishes when I press play.. Is there an updated version of the script??. I'm using Unity 5.3.3f1 with TMP v0.1.54 ... Any help would be appreciated..
Thanks!!

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #79 on: March 23, 2016, 11:53:01 PM »
Hey,
I'm new to TMP and I just updated to v 0.1.54 beta 1b, I'm trying to warp a text and found this forum looking for ways to do that.. I have the VertexAttributeModifier.cs and have added it to a TMP text object.. But somehow its not working properly, the text just vanishes when I press play.. Is there an updated version of the script??. I'm using Unity 5.3.3f1 with TMP v0.1.54 ... Any help would be appreciated..
Thanks!!

Attached is a quick revision of the WarpText portion of the VertexAttributeModifier.cs script.

Just attach this new script to a TextMeshPro object and it should do the trick.

Code: C#
  1. using UnityEngine;
  2. using System.Collections;
  3. using TMPro;
  4.  
  5. public class WarpTextExample : MonoBehaviour
  6. {
  7.  
  8.    private TMP_Text m_TextComponent;
  9.  
  10.    public AnimationCurve VertexCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.25f, 2.0f), new Keyframe(0.5f, 0), new Keyframe(0.75f, 2.0f), new Keyframe(1, 0f));
  11.    public float AngleMultiplier = 1.0f;
  12.    public float SpeedMultiplier = 1.0f;
  13.    public float CurveScale = 1.0f;
  14.  
  15.    void Awake()
  16.    {
  17.        m_TextComponent = gameObject.GetComponent<TMP_Text>();
  18.    }
  19.  
  20.  
  21.    void Start()
  22.    {
  23.        StartCoroutine(WarpText());
  24.    }
  25.  
  26.  
  27.    private AnimationCurve CopyAnimationCurve(AnimationCurve curve)
  28.    {
  29.        AnimationCurve newCurve = new AnimationCurve();
  30.  
  31.        newCurve.keys = curve.keys;
  32.  
  33.        return newCurve;
  34.    }
  35.  
  36.  
  37.    /// <summary>
  38.    ///  Method to curve text along a Unity animation curve.
  39.    /// </summary>
  40.    /// <param name="textComponent"></param>
  41.    /// <returns></returns>
  42.    IEnumerator WarpText()
  43.    {
  44.        VertexCurve.preWrapMode = WrapMode.Clamp;
  45.        VertexCurve.postWrapMode = WrapMode.Clamp;
  46.  
  47.        Mesh mesh = m_TextComponent.textInfo.meshInfo[0].mesh;
  48.  
  49.        Vector3[] vertices;
  50.        Matrix4x4 matrix;
  51.  
  52.        m_TextComponent.havePropertiesChanged = true; // Need to force the TextMeshPro Object to be updated.
  53.        CurveScale *= 10;
  54.        float old_CurveScale = CurveScale;
  55.        AnimationCurve old_curve = CopyAnimationCurve(VertexCurve);
  56.  
  57.        while (true)
  58.        {
  59.            if (!m_TextComponent.havePropertiesChanged && old_CurveScale == CurveScale && old_curve.keys[1].value == VertexCurve.keys[1].value)
  60.            {
  61.                yield return null;
  62.                continue;
  63.            }
  64.  
  65.            old_CurveScale = CurveScale;
  66.            old_curve = CopyAnimationCurve(VertexCurve);
  67.  
  68.            m_TextComponent.ForceMeshUpdate(); // Generate the mesh and populate the textInfo with data we can use and manipulate.
  69.  
  70.            TMP_TextInfo textInfo = m_TextComponent.textInfo;
  71.            int characterCount = textInfo.characterCount;
  72.  
  73.  
  74.            if (characterCount == 0) continue;
  75.  
  76.            //vertices = textInfo.meshInfo[0].vertices;
  77.            //int lastVertexIndex = textInfo.characterInfo[characterCount - 1].vertexIndex;
  78.  
  79.            float boundsMinX = mesh.bounds.min.x;
  80.            float boundsMaxX = mesh.bounds.max.x;
  81.  
  82.  
  83.            for (int i = 0; i < characterCount; i++)
  84.            {
  85.                if (!textInfo.characterInfo[i].isVisible)
  86.                    continue;
  87.  
  88.                int vertexIndex = textInfo.characterInfo[i].vertexIndex;
  89.  
  90.                // Get the index of the mesh used by this character.
  91.                int meshIndex = textInfo.characterInfo[i].materialReferenceIndex;
  92.  
  93.                vertices = textInfo.meshInfo[meshIndex].vertices;
  94.  
  95.                // Compute the baseline mid point for each character
  96.                Vector3 offsetToMidBaseline = new Vector2((vertices[vertexIndex + 0].x + vertices[vertexIndex + 2].x) / 2, textInfo.characterInfo[i].baseLine);
  97.                //float offsetY = VertexCurve.Evaluate((float)i / characterCount + loopCount / 50f); // Random.Range(-0.25f, 0.25f);
  98.  
  99.                // Apply offset to adjust our pivot point.
  100.                vertices[vertexIndex + 0] += -offsetToMidBaseline;
  101.                vertices[vertexIndex + 1] += -offsetToMidBaseline;
  102.                vertices[vertexIndex + 2] += -offsetToMidBaseline;
  103.                vertices[vertexIndex + 3] += -offsetToMidBaseline;
  104.  
  105.                // Compute the angle of rotation for each character based on the animation curve
  106.                float x0 = (offsetToMidBaseline.x - boundsMinX) / (boundsMaxX - boundsMinX); // Character's position relative to the bounds of the mesh.
  107.                float x1 = x0 + 0.0001f;
  108.                float y0 = VertexCurve.Evaluate(x0) * CurveScale;
  109.                float y1 = VertexCurve.Evaluate(x1) * CurveScale;
  110.  
  111.                Vector3 horizontal = new Vector3(1, 0, 0);
  112.                //Vector3 normal = new Vector3(-(y1 - y0), (x1 * (boundsMaxX - boundsMinX) + boundsMinX) - offsetToMidBaseline.x, 0);
  113.                Vector3 tangent = new Vector3(x1 * (boundsMaxX - boundsMinX) + boundsMinX, y1) - new Vector3(offsetToMidBaseline.x, y0);
  114.  
  115.                float dot = Mathf.Acos(Vector3.Dot(horizontal, tangent.normalized)) * 57.2957795f;
  116.                Vector3 cross = Vector3.Cross(horizontal, tangent);
  117.                float angle = cross.z > 0 ? dot : 360 - dot;
  118.  
  119.                matrix = Matrix4x4.TRS(new Vector3(0, y0, 0), Quaternion.Euler(0, 0, angle), Vector3.one);
  120.  
  121.                vertices[vertexIndex + 0] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 0]);
  122.                vertices[vertexIndex + 1] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 1]);
  123.                vertices[vertexIndex + 2] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 2]);
  124.                vertices[vertexIndex + 3] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 3]);
  125.  
  126.                vertices[vertexIndex + 0] += offsetToMidBaseline;
  127.                vertices[vertexIndex + 1] += offsetToMidBaseline;
  128.                vertices[vertexIndex + 2] += offsetToMidBaseline;
  129.                vertices[vertexIndex + 3] += offsetToMidBaseline;
  130.            }
  131.  
  132.  
  133.            // Upload the mesh with the revised information
  134.            m_TextComponent.UpdateVertexData();
  135.  
  136.            yield return new WaitForSeconds(0.025f);
  137.        }
  138.    }
  139.  
  140. }
  141.  

« Last Edit: March 24, 2016, 12:08:26 AM by Stephan B. »

eyalm

  • Newbie
  • *
  • Posts: 10
Re: Text along a curve
« Reply #80 on: March 30, 2016, 11:40:33 PM »
Hey,
I'm new to TMP and I just updated to v 0.1.54 beta 1b, I'm trying to warp a text and found this forum looking for ways to do that.. I have the VertexAttributeModifier.cs and have added it to a TMP text object.. But somehow its not working properly, the text just vanishes when I press play.. Is there an updated version of the script??. I'm using Unity 5.3.3f1 with TMP v0.1.54 ... Any help would be appreciated..
Thanks!!

Attached is a quick revision of the WarpText portion of the VertexAttributeModifier.cs script.

Just attach this new script to a TextMeshPro object and it should do the trick.

Code: C#
  1. using UnityEngine;
  2. using System.Collections;
  3. using TMPro;
  4.  
  5. public class WarpTextExample : MonoBehaviour
  6. {
  7.  
  8.    private TMP_Text m_TextComponent;
  9.  
  10.    public AnimationCurve VertexCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.25f, 2.0f), new Keyframe(0.5f, 0), new Keyframe(0.75f, 2.0f), new Keyframe(1, 0f));
  11.    public float AngleMultiplier = 1.0f;
  12.    public float SpeedMultiplier = 1.0f;
  13.    public float CurveScale = 1.0f;
  14.  
  15.    void Awake()
  16.    {
  17.        m_TextComponent = gameObject.GetComponent<TMP_Text>();
  18.    }
  19.  
  20.  
  21.    void Start()
  22.    {
  23.        StartCoroutine(WarpText());
  24.    }
  25.  
  26.  
  27.    private AnimationCurve CopyAnimationCurve(AnimationCurve curve)
  28.    {
  29.        AnimationCurve newCurve = new AnimationCurve();
  30.  
  31.        newCurve.keys = curve.keys;
  32.  
  33.        return newCurve;
  34.    }
  35.  
  36.  
  37.    /// <summary>
  38.    ///  Method to curve text along a Unity animation curve.
  39.    /// </summary>
  40.    /// <param name="textComponent"></param>
  41.    /// <returns></returns>
  42.    IEnumerator WarpText()
  43.    {
  44.        VertexCurve.preWrapMode = WrapMode.Clamp;
  45.        VertexCurve.postWrapMode = WrapMode.Clamp;
  46.  
  47.        Mesh mesh = m_TextComponent.textInfo.meshInfo[0].mesh;
  48.  
  49.        Vector3[] vertices;
  50.        Matrix4x4 matrix;
  51.  
  52.        m_TextComponent.havePropertiesChanged = true; // Need to force the TextMeshPro Object to be updated.
  53.        CurveScale *= 10;
  54.        float old_CurveScale = CurveScale;
  55.        AnimationCurve old_curve = CopyAnimationCurve(VertexCurve);
  56.  
  57.        while (true)
  58.        {
  59.            if (!m_TextComponent.havePropertiesChanged && old_CurveScale == CurveScale && old_curve.keys[1].value == VertexCurve.keys[1].value)
  60.            {
  61.                yield return null;
  62.                continue;
  63.            }
  64.  
  65.            old_CurveScale = CurveScale;
  66.            old_curve = CopyAnimationCurve(VertexCurve);
  67.  
  68.            m_TextComponent.ForceMeshUpdate(); // Generate the mesh and populate the textInfo with data we can use and manipulate.
  69.  
  70.            TMP_TextInfo textInfo = m_TextComponent.textInfo;
  71.            int characterCount = textInfo.characterCount;
  72.  
  73.  
  74.            if (characterCount == 0) continue;
  75.  
  76.            //vertices = textInfo.meshInfo[0].vertices;
  77.            //int lastVertexIndex = textInfo.characterInfo[characterCount - 1].vertexIndex;
  78.  
  79.            float boundsMinX = mesh.bounds.min.x;
  80.            float boundsMaxX = mesh.bounds.max.x;
  81.  
  82.  
  83.            for (int i = 0; i < characterCount; i++)
  84.            {
  85.                if (!textInfo.characterInfo[i].isVisible)
  86.                    continue;
  87.  
  88.                int vertexIndex = textInfo.characterInfo[i].vertexIndex;
  89.  
  90.                // Get the index of the mesh used by this character.
  91.                int meshIndex = textInfo.characterInfo[i].materialReferenceIndex;
  92.  
  93.                vertices = textInfo.meshInfo[meshIndex].vertices;
  94.  
  95.                // Compute the baseline mid point for each character
  96.                Vector3 offsetToMidBaseline = new Vector2((vertices[vertexIndex + 0].x + vertices[vertexIndex + 2].x) / 2, textInfo.characterInfo[i].baseLine);
  97.                //float offsetY = VertexCurve.Evaluate((float)i / characterCount + loopCount / 50f); // Random.Range(-0.25f, 0.25f);
  98.  
  99.                // Apply offset to adjust our pivot point.
  100.                vertices[vertexIndex + 0] += -offsetToMidBaseline;
  101.                vertices[vertexIndex + 1] += -offsetToMidBaseline;
  102.                vertices[vertexIndex + 2] += -offsetToMidBaseline;
  103.                vertices[vertexIndex + 3] += -offsetToMidBaseline;
  104.  
  105.                // Compute the angle of rotation for each character based on the animation curve
  106.                float x0 = (offsetToMidBaseline.x - boundsMinX) / (boundsMaxX - boundsMinX); // Character's position relative to the bounds of the mesh.
  107.                float x1 = x0 + 0.0001f;
  108.                float y0 = VertexCurve.Evaluate(x0) * CurveScale;
  109.                float y1 = VertexCurve.Evaluate(x1) * CurveScale;
  110.  
  111.                Vector3 horizontal = new Vector3(1, 0, 0);
  112.                //Vector3 normal = new Vector3(-(y1 - y0), (x1 * (boundsMaxX - boundsMinX) + boundsMinX) - offsetToMidBaseline.x, 0);
  113.                Vector3 tangent = new Vector3(x1 * (boundsMaxX - boundsMinX) + boundsMinX, y1) - new Vector3(offsetToMidBaseline.x, y0);
  114.  
  115.                float dot = Mathf.Acos(Vector3.Dot(horizontal, tangent.normalized)) * 57.2957795f;
  116.                Vector3 cross = Vector3.Cross(horizontal, tangent);
  117.                float angle = cross.z > 0 ? dot : 360 - dot;
  118.  
  119.                matrix = Matrix4x4.TRS(new Vector3(0, y0, 0), Quaternion.Euler(0, 0, angle), Vector3.one);
  120.  
  121.                vertices[vertexIndex + 0] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 0]);
  122.                vertices[vertexIndex + 1] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 1]);
  123.                vertices[vertexIndex + 2] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 2]);
  124.                vertices[vertexIndex + 3] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 3]);
  125.  
  126.                vertices[vertexIndex + 0] += offsetToMidBaseline;
  127.                vertices[vertexIndex + 1] += offsetToMidBaseline;
  128.                vertices[vertexIndex + 2] += offsetToMidBaseline;
  129.                vertices[vertexIndex + 3] += offsetToMidBaseline;
  130.            }
  131.  
  132.  
  133.            // Upload the mesh with the revised information
  134.            m_TextComponent.UpdateVertexData();
  135.  
  136.            yield return new WaitForSeconds(0.025f);
  137.        }
  138.    }
  139.  
  140. }
  141.  



This scripts throw errors:
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(91,59): error CS1061: Type `TMPro.TMP_CharacterInfo' does not contain a definition for `materialReferenceIndex' and no extension method `materialReferenceIndex' of type `TMPro.TMP_CharacterInfo' could be found (are you missing a using directive or an assembly reference?)
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(134,29): error CS1061: Type `TMPro.TMP_Text' does not contain a definition for `UpdateVertexData' and no extension method `UpdateVertexData' of type `TMPro.TMP_Text' could be found (are you missing a using directive or an assembly reference?)
How do I fix it?

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #81 on: March 30, 2016, 11:46:42 PM »

This scripts throw errors:
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(91,59): error CS1061: Type `TMPro.TMP_CharacterInfo' does not contain a definition for `materialReferenceIndex' and no extension method `materialReferenceIndex' of type `TMPro.TMP_CharacterInfo' could be found (are you missing a using directive or an assembly reference?)
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(134,29): error CS1061: Type `TMPro.TMP_Text' does not contain a definition for `UpdateVertexData' and no extension method `UpdateVertexData' of type `TMPro.TMP_Text' could be found (are you missing a using directive or an assembly reference?)
How do I fix it?

You are getting those error because you are most likely not using the latest release of TextMesh Pro available on the user forum here. This updated code version is for Release 0.1.54 which includes Multi Font & Sprites support where this materialReferenceIndex is used.

The latest release is 0.1.54 Beta 1c which is located in the "TMPro - Alpha & Beta Releases" section of the forum. Be sure to read the release note and upgrade notes.
« Last Edit: March 30, 2016, 11:54:24 PM by Stephan B. »

eyalm

  • Newbie
  • *
  • Posts: 10
Re: Text along a curve
« Reply #82 on: March 31, 2016, 01:44:26 AM »

This scripts throw errors:
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(91,59): error CS1061: Type `TMPro.TMP_CharacterInfo' does not contain a definition for `materialReferenceIndex' and no extension method `materialReferenceIndex' of type `TMPro.TMP_CharacterInfo' could be found (are you missing a using directive or an assembly reference?)
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(134,29): error CS1061: Type `TMPro.TMP_Text' does not contain a definition for `UpdateVertexData' and no extension method `UpdateVertexData' of type `TMPro.TMP_Text' could be found (are you missing a using directive or an assembly reference?)
How do I fix it?

You are getting those error because you are most likely not using the latest release of TextMesh Pro available on the user forum here. This updated code version is for Release 0.1.54 which includes Multi Font & Sprites support where this materialReferenceIndex is used.

The latest release is 0.1.54 Beta 1c which is located in the "TMPro - Alpha & Beta Releases" section of the forum. Be sure to read the release note and upgrade notes.

Thanks this is working great now!
Btw you have a really fast support this is great! :)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #83 on: March 31, 2016, 02:05:31 AM »

This scripts throw errors:
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(91,59): error CS1061: Type `TMPro.TMP_CharacterInfo' does not contain a definition for `materialReferenceIndex' and no extension method `materialReferenceIndex' of type `TMPro.TMP_CharacterInfo' could be found (are you missing a using directive or an assembly reference?)
Code: [Select]
Assets/Scripts/Game/Effects/CurvedText.cs(134,29): error CS1061: Type `TMPro.TMP_Text' does not contain a definition for `UpdateVertexData' and no extension method `UpdateVertexData' of type `TMPro.TMP_Text' could be found (are you missing a using directive or an assembly reference?)
How do I fix it?

You are getting those error because you are most likely not using the latest release of TextMesh Pro available on the user forum here. This updated code version is for Release 0.1.54 which includes Multi Font & Sprites support where this materialReferenceIndex is used.

The latest release is 0.1.54 Beta 1c which is located in the "TMPro - Alpha & Beta Releases" section of the forum. Be sure to read the release note and upgrade notes.

Thanks this is working great now!
Btw you have a really fast support this is great! :)

When I am awake I do :)

Sadly I do need to sleep and then my response rate is slower.

eyalm

  • Newbie
  • *
  • Posts: 10
Re: Text along a curve
« Reply #84 on: March 31, 2016, 02:35:00 AM »
I see.
Btw why don't you add this script to the official release?
When I first looked for a text plugin I'v been searching for this option as well.
I picked your plugin because it looked like the best option but I know i didn't have to think about it that much if it was written in the asset store that it has curved text option built in.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #85 on: March 31, 2016, 02:44:15 AM »
I see.
Btw why don't you add this script to the official release?
When I first looked for a text plugin I'v been searching for this option as well.
I picked your plugin because it looked like the best option but I know i didn't have to think about it that much if it was written in the asset store that it has curved text option built in.

I am trying to keep the package size down and since not everyone needs these scripts, it makes sense to have them available on the user forum.

On the flip side, I can see how finding which script works with which version can be challenging so these examples / scripts could certainly be better organized which is something that I'll need to get to at some point.

eyalm

  • Newbie
  • *
  • Posts: 10
Re: Text along a curve
« Reply #86 on: March 31, 2016, 04:44:55 AM »
I'v encountered a problem, I need to keep the same curve style to all kind of texts but the curve will change according to the length of the string.
Is there a way to make it constant no matter the amount of characters?
« Last Edit: March 31, 2016, 05:58:37 AM by eyalm »

eyalm

  • Newbie
  • *
  • Posts: 10
Re: Text along a curve
« Reply #87 on: April 04, 2016, 11:18:12 PM »
Is there any solution for this?

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Text along a curve
« Reply #88 on: April 05, 2016, 12:01:47 AM »
Is there any solution for this?

You would need to modify the script so that instead of using the position of each character relative to the bound of the text, it uses some fix width.

In the example script above, line 106 is where these calculations begin to determine the position of the characters on the curve.

eyalm

  • Newbie
  • *
  • Posts: 10
Re: Text along a curve
« Reply #89 on: April 05, 2016, 03:06:07 AM »
Is there any solution for this?

You would need to modify the script so that instead of using the position of each character relative to the bound of the text, it uses some fix width.

In the example script above, line 106 is where these calculations begin to determine the position of the characters on the curve.

Thanks it works great!