Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

FlyingText3D - Real dynamic 3D text from TrueType fonts

Discussion in 'Assets and Asset Store' started by Eric5h5, Jun 11, 2012.

  1. Extreme_u3Damon

    Extreme_u3Damon

    Joined:
    Aug 6, 2012
    Posts:
    66
    Hey ! i just wonder if it has right-to-left language support ?! such as , Persian , Arabic , ... one of my team mates will need some right-to-left language texts on our project
     
  2. polytropoi

    polytropoi

    Joined:
    Aug 16, 2006
    Posts:
    677
    Another first class tool, thanks Eric! Now I want to make flying ebooks with it, of course. :) A couple of questions: is there a way to update the text property of a FlyingText object after it's been created? I'm having to destroy and recreate a new one to change the text. Also, do you have any pointers on how to do word wrapping? I guess I can just count chars and insert \n as needed.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Of course. ;)

    Currently that's the method you would indeed use (since GetObject returns a GameObject), but I was considering a ChangeText function or something that would update the mesh of an existing object.

    That's a good idea for a new feature (added that to the list). The problem with counting characters is that only works for fixed-width fonts. The character widths are available internally, so it would have to be done in the GetObject function in FlyingText.cs.

    --Eric
     
  4. paprocjo

    paprocjo

    Joined:
    May 16, 2012
    Posts:
    12
    So I am still a bit new to coding text in unity and have had a blast using your tool. Is there a way to set the maximum number of words that will display before it creates a new line? I need to have fill in a specific area with text and only that area.
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    At the moment you'd have to do that manually, but I will be adding word wrapping to the next version.

    --Eric
     
  6. paprocjo

    paprocjo

    Joined:
    May 16, 2012
    Posts:
    12
    I also deleted the pdf that came with it, is there any way to redownload just that?
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    I'm assuming you got it from the Asset Store? You should be able to re-import what you need.

    --Eric
     
  8. Doug Steen

    Doug Steen

    Joined:
    Nov 20, 2012
    Posts:
    2
    Hi Eric,

    Great product! I just purchased it today. Really easy to use!

    I'm having a problem with some fonts I downloaded where specific letters are not being rendered. I'm receiving "Couldn't complete triangulation" and "Triangulation failed for char code nn (x)" error messages.

    Any pointers you can give me?

    Thanks again for the great product!

    Doug
     
  9. Doug Steen

    Doug Steen

    Joined:
    Nov 20, 2012
    Posts:
    2
    Hi Eric,

    Helps to read the documentation! :)

    I upped the resolution on the font and it worked great!

    I'd love to give you a review in the Asset store, but I purchased it through your site. Do you know of any method for me to leave a review on the Asset store?

    Thanks again for a great product!
    Doug
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    I don't think there's a way, but I'm glad you like it. :)

    --Eric
     
  11. gonzorob

    gonzorob

    Joined:
    Dec 1, 2011
    Posts:
    96
    Hi Eric,

    I'm trying to work out the individual character local position within a word. So, for example "HELLO", "H" would be (-3,0) "E" would be (-2,0) etc etc. I'm going to be using this data later on to arrange individual characters...

    Currently I'm doing this by making a word with each character as a child.. cycling through each child transform and saving the local position. It works, but it's a pretty slapdash way of doing it. Is there a function within the FlyingText source that would do this for me? Or do you know a (perhaps .NET) method of working out the the correct character position within a string?

    Any help would be greatly appreciated.

    Robin
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    There isn't currently an actual function that will do this, but in the FlyingText.cs script, the loop starting on line 328 has a horizontalPosition variable. You could use this variable in some way, probably by creating a list and adding horizontalPosition to the list for each character (after line 404 to make sure that it has the correct value), then when the loop is done you'd have a list of each horizontal position. Also you could add verticalPosition if you need the positions for more than one line.

    --Eric
     
  13. gonzorob

    gonzorob

    Joined:
    Dec 1, 2011
    Posts:
    96
    Awesome, I'll give that a go! :)

    Thanks for the quick response!
     
  14. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,029
    Is there any way to have one material on the front face of the letters and another on the extruded edges? (or UV map a single texture like that)?
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Not currently, sorry.

    --Eric
     
  16. Siberdt

    Siberdt

    Joined:
    Dec 15, 2009
    Posts:
    55
    Thanx, Eric, for this great solution. I stopped with current project and meditate with fonts. :)

    A sort of suggestion: it would be nice to have an option to update the current mesh of GO, not just create the new one.

    And, please put the special LogError, when default material was not defined. The code checks if material fails, it outputs the common message about the scripts execution order. It looks not clear.
     
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    OK, that makes sense.

    --Eric
     
  18. Siberdt

    Siberdt

    Joined:
    Dec 15, 2009
    Posts:
    55
    Thank You.

    Yeah, Mesh.Clear is much better, than Object.Destroy, if someone want to fast updating texts, for example scores, combos etc.

    And sorry, my fault... I said "material" but wanted "font".
    There is a label, right near the font selection field and after some tests in inspector this label was filled by font name.

    And the name was kept even on new object, when I started runtime tests. So, I see the name, think "OK" and after pressing the Play button get the LogError with scripts order warning.

    I used the dll, and had no idea of the empty field font. Only after loading the sources, I found it :)
     
    Last edited: Mar 5, 2013
  19. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Eric - Got any videos? Or demos? I've used Vectrosity for almost 2 years and just noticed your newest addition, FlyingText. But, I'm not really sure what it does and the one GameOver Video is too simple. Please make one of those tutorial type vids showing how to use it and what it can do. Thanks.

    Gigi.
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    It makes text into actual 3D objects. Like the "3D Text" function in Unity, except with real 3D objects, not bitmap-on-a-plane.

    --Eric
     
  21. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    I'm going to ask some dumb questions. The kind of stuff I should feel silly asking, but I'm going to do it anyway. These are the kinds of things I like to learn in a video, so I don't have to look dumb here. :)

    - How many draws does it take?
    - What is the performance impact?
    - Does it need a special camera?
    - How does it integrate into my existing scene/camera setup?
    - Does it play well with others? I have EZGui and 2D and 3D objects and several cameras...
    - How much code does the 'Game Over' demo take? Moving from a full object, to individual physics objects... maybe that changes the performance or changes the draw calls...
    - What kinds of fonts can it do? I'm sort of famililar with TTF, but, not sure of the implications if I want to develop on a mac, deploy to the web, test on a windows (Firefox browser), and release the product on iOS.
    - Other than the few screen shots, can you show some other things it can do? Like can I move the objects around easily, can I line the font up along a shape (like a semi-circle).

    I'm a long-time customer of Vectrosity, but $40 is $40. If it was $15 or $20, I'd just buy it, without a 2nd thought, but $40 has crossed some mystical threshold that makes me hesitate. My mind is a terrible thing.

    Curtiss
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    There's no chance I could cover 100% of questions that everybody might have in a video, so you'd have to ask here anyway. ;)

    Not sure what you mean? If you're talking about draw calls, that's either 1 if you want all the text rendered as a single object, or if you want each letter as a separate object, then it depends on the number of letters.

    Depends on the amount of text, resolution of text (higher resolution = more polygons), shader, etc. Same as any other GameObject.

    No, text is converted to a standard GameObject or GameObjects.

    Text is a standard GameObject or GameObjects.

    Text is a standard GameObject or GameObjects.

    Here's the relevant code, not including the CameraShake routine (note that only the first line is specific to FlyingText3D):

    Code (csharp):
    1.         var gameOverText = FlyingText.GetObjects ("GAME<br>OVER").transform;
    2.         gameOverText.position.z = -6.5;
    3.         var rigidbodies = gameOverText.GetComponentsInChildren.<Rigidbody>();
    4.         for (var rb in rigidbodies) {
    5.             rb.useGravity = false;
    6.         }
    7.        
    8.         for (var i = 0.0; i < 1.0; i += Time.deltaTime) {
    9.             gameOverText.position.y = Mathf.Lerp (5.0, -.05, i);
    10.             yield;
    11.         }
    12.         CameraShake (Camera.main);
    13.        
    14.         yield WaitForSeconds(1.75);
    15.        
    16.         Instantiate (explosion, Vector3(0.0, 1.0, -6.3), Quaternion.identity);
    17.         for (var rb in rigidbodies) {
    18.             rb.useGravity = true;
    19.             rb.AddExplosionForce (220.0, Vector3(0, 1, -6.5), 10.0, 9.0);
    20.         }
    21.        
    22.         yield WaitForSeconds(5.0);
    23.         Destroy (gameOverText.gameObject);
    Note that you don't have to use code at all; if you just want some text converted to a GameObject, you can use the FlyingText inspector, then it will be in your scene and you can make it into a prefab or whatever.

    TTF.

    There aren't any implications, since text is converted to a standard GameObject; the TTF file is not used as an actual font, just as data. If you create text with the FlyingText inspector, then you don't need to include the TTF file at all. You only need it if you're creating dynamic text at runtime.

    Text is a standard GameObject (or GameObjects), so you can do whatever you like with it.

    It is $20, for the indie license.

    --Eric
     
  23. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Keep rocking the plugins and fantastic reply Eric! If the need arises, I'll grab it. Or, if it goes on sale at some future point, please PM me and I'll purchase it straight away :).

    Gigi
     
  24. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    534
    playmaker support is there?
     
  25. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    I'm not really familiar with how PlayMaker works.

    --Eric
     
  26. Araugnir

    Araugnir

    Joined:
    Aug 20, 2012
    Posts:
    5
    Hello,

    I'm making a game for consoles (360 PS3), and I'd like to know what namespaces your plugin uses. Also, looking at the package content in the asset store, I saw a dll. Is this a C# assembly or a native C dll?

    Thanks in advance!
     
  27. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    The DLL is optional (source code is included), but in any case it's C#. It imports UnityEngine, System.Collections.Generic, System.Globalization, and System.Text.

    --Eric
     
  28. Araugnir

    Araugnir

    Joined:
    Aug 20, 2012
    Posts:
    5
    Thank you for your quick reply. Then I think we can use your plugin with consoles with no problems :D

    EDIT: Worked perfectly. Thank you so much :)
     
    Last edited: Mar 12, 2013
  29. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    193
    Just bought the plugin and I noticed that when I use Texture Per Letter option to have individual letter GameObjects, the order of the letter game objects is not the same as the order of the letters in the string I use (although the letters on screen appear fine because of their adjusted position).

    For example, if I use the word "odin", I would get the following in the Hierarchy:

    3DText odin
    d
    i
    n
    o

    That makes impossible for me to loop through them and assume that I would get the correct individual letter GameObject based on my original string.

    Is there a way to make the order of the letter transforms in the root object in order?

    Thanks,
    Andreas.
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Texture Per Letter is actually not related to this; if you're getting text as individual objects, they always use Texture Per Letter anyway. It only has any effect if you're getting text as a single object.

    Anyway, the letter objects are added in order when they're computed, but indeed the order of children objects isn't actually defined (the hierarchy sorts them alphabetically). It's fairly simple to sort them by position though...if you did GetComponentsInChildren<Transform> and sorted that array by X position, then the array would be in the order of the string. However it sounds like it would be a good idea to have a function that just returns the array of objects, which would save having to sort it afterward.

    --Eric
     
  31. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    193
    Hey Eric,
    Thanks for your reply.

    Following your suggestion, I've now solved my issue as follows:

    Code (csharp):
    1. var text = FlyingText.GetObjects(ourString);
    2. var sorted = text.GetComponentsInChildren<Transform>().Where(tr => tr.gameObject != text).OrderBy(tr => tr.position.x);
     
  32. paprocjo

    paprocjo

    Joined:
    May 16, 2012
    Posts:
    12
    What would be the best way to get the letters to wrap around a cylinder $5578461-illustration-of-a-3d-globe-with-credit-card-style-text-wrapping-around-isolated-on-white.jp ?
     
  33. polytropoi

    polytropoi

    Joined:
    Aug 16, 2006
    Posts:
    677
    Maybe with this?
     
  34. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Yes, that would probably be the easiest way. If you get the letters as individual objects, you could potentially arrange them in a circle and rotate each letter as appropriate, which would require some calculating.

    --Eric
     
  35. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    194
    I'm convinced - buying !
     
  36. kreddy

    kreddy

    Joined:
    Oct 5, 2012
    Posts:
    9
    Hey Eric,

    Just bought the package!
    What would be the best way to edit the text dynamically? Players type out sentences in my game, and I want to give real-time feedback of what they type. Is it possible to change the text like you can change the color/font/spacing etc?

    thanks,
    Kedar
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Currently you'd need to destroy the GameObject and create a new one when the text is changed. This actually works quite well but isn't exactly elegant, so the next version will have the ability to update 3D text.

    --Eric
     
  38. kreddy

    kreddy

    Joined:
    Oct 5, 2012
    Posts:
    9
    Hey Eric,

    Another question: When I make the text smaller than a certain size(compared to the screen size) it has very bad aliasing effects--it starts to shimmer/glitter when I pan the camera about it. It doesn't happen when the camera is still, or when the text is large enough. Any ideas what might be causing this ? FYI, I'm using an orthographic camera, and the VertexLit shader that comes with Unity.

    thanks,
    Kedar
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    You can try turning on FSAA. The text is standard mesh geometry, so anything regarding small details in meshes would also apply in this case.

    --Eric
     
  40. kreddy

    kreddy

    Joined:
    Oct 5, 2012
    Posts:
    9
    Haha, I googled FSAA and came across another post in a different forum where you were explaining to someone how to turn on FSAA. Unfortunately, I didn't understand too much. I assume it's a setting on my computer for anti-aliasing? I'm working on a MacBook Pro (retina), any idea where I can find this setting? thanks.
     
  41. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    It's in the quality settings.

    --Eric
     
  42. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,021
    Shopping around for a good 3D text plugin. TTF Text has a nice bevel/extrude feature that lets you have outlines and separate materials for the edges -- any plans to have that in FlyingText? Does FlyingText's 'resolution' setting affect the number of tris? That'd be a big advantage over TTF Text if so.
     
  43. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    FlyingText will get a bevel feature at some point. The resolution setting does affect the number of tris...the lower the resolution, the fewer the tris (and verts).

    --Eric
     
  44. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,021
    Bought. Hope to see bevel soon (I mostly just want to be able to create different color outlines/extrusions) -- in the meantime I guess I can fake it (one extruded in one color, one flat slightly offset to sit on top in another color)
     
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Version 1.3 will be done soon(ish)...includes the ability to use separate materials for faces and edges, plus a bunch of other stuff.



    --Eric
     
  46. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Well, I changed my mind...there won't be a version 1.3. There were too many changes, and it works a little differently than before, so now it's version 2.0, which is out now! Update notices have been sent to everyone who bought from my website (and remembered to turn update notifications on!). It's a free update as usual. I'll update it for the Asset Store next. Changes this time (deep breath):

    FlyingText3D 2.0

    Additions:
    • Separate materials for the front/back faces and extruded edges can be used now. As such there is a defaultEdgeMaterial variable, and a useEdgeMaterial variable. If useEdgeMaterial is false, then only the standard material will be used.
    • An UpdateObject function, so that a previously-made text object can be updated with new text, instead of having to destroy/recreate game objects.
    • A defaultLineWidth variable, for specifying the maximum number of world units wide a line can be (0 means no limit). If this width is exceeded, then the text flows to a new line.
    • A wordWrap variable, which is only used if the default line width is greater than 0. If wordWrap is true, then any line that would exceed the line width is broken at the last full word instead of the last letter.
    • GetObjectsArray function, which returns a GameObject array containing separate letters. Contrast to the existing GetObjects function, which returns a single GameObject with separate letters as children. Use GetObjectsArray if you want the array of letters to be in a defined order (namely, the order of objects in the array corresponds to the order of letters in the text).
    • A verticalLayout variable, which, if true, makes text flow vertically instead of horizontally. A newline character will start another column in this case.
    • Support for tab characters with a tabStop variable, so a tab will make the next character start at the next available position that's a multiple of tabStop. This is specified in world units, where 0 means tabs are not used.

    Changes:
    • You can add a position and rotation when calling the GetObject functions, so the generated objects are positioned/rotated accordingly. Just like Instantiate: "FlyingText.GetObject (myText, Vector3(10, 0, 5), Quaternion.Euler(0, 45, 0))".
    • As the result of having the option for a separate edge material, the GetObject functions require two materials to be specified (if you're specifying any material at all): the standard material first and the edge material second. If you're not using an edge material, you can write "null".
    • When calling the GetObject functions and specifying the character spacing/line spacing, you must also specify the line width. So the complete version is now "GetObject (text, material, edgeMaterial, size, extrudeDepth, resolution, characterSpacing, lineSpacing, lineWidth)". (Plus position and rotation if desired, as mentioned above.)
    • The text anchor now uses the vertical extents from the font as a whole rather than individual characters. This is so text placement will be consistent if the text is changed. As a result, text will be positioned somewhat differently compared to previous versions, especially for the upper and lower options.
    • Mesh colliders (convex or otherwise) can be used for combined text that's not split into separate letter objects. Just keep in mind that mesh colliders can be CPU-intensive to compute, so complex text with a mesh collider may be subject to a delay before it appears.
    • It's possible to use right justification and center justification with single lines of text now. Since with the addition of line width, there's something to justify it to (as long as the line width is not 0).
    • If no fonts are defined, a specific error about this is generated rather than the "FlyingText hasn't been initialized yet" error.
    • An empty string can be passed for the text when using the GetObject functions. You might use this to initialize a text object using GetObject, so it can be updated later with actual text using UpdateObject.
    • Character spacing can be negative.
    • The "text settings" section in the FlyingText inspector has been split into two sections, "character settings" and "text settings", where the character settings are for the things that affects how the letter objects actually look, and the text settings are for the things that affects how the text is arranged.
    • Requires Unity 3.5 as a minimum now.

    Fixes:
    • Color and depth tags work correctly in strings with multiple lines.
    • Changing FlyingText.includeBackface between GetObject calls no longer causes errors.

    --Eric
     
  47. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    And, er, version 2.0.1 is out now...oops....

    Fixes:
    • Fixed silly Color/Color32 bug that prevented <color> tags from working.

    --Eric
     
  48. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    And version 2.0.1 is now available on the Asset Store. (Which it was several days ago actually...but I neglected to mention....)

    --Eric
     
  49. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,029
    I've got 2.0.1 and used it to create some new meshes last weekend, but now I'm getting this error when I click Create. Any suggestions?

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[System.Single].get_Item (Int32 index) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    FlyingText.GetObject (System.String s, UnityEngine.Material material, UnityEngine.Material edgeMaterial, Single size, Single extrudeDepth, Int32 resolution, Single characterSpacing, Single lineSpacing, Single lineWidth, Boolean prime, Boolean separateObjects, Boolean useObjectsArray, Vector3 position, Quaternion rotation, UnityEngine.GameObject gObject)
    FlyingText.GetObject (System.String text)
    FlyingTextInspector.OnInspectorGUI () (at Assets/Editor/FlyingTextInspector.js:156)
    UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
    UnityEditor.DockArea:OnGUI()
     
  50. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,149
    Do you have a font set up?

    --Eric