Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Make TextMesh Face Camera

Discussion in 'Scripting' started by spellstorm-realms, Jun 15, 2014.

Thread Status:
Not open for further replies.
  1. spellstorm-realms

    spellstorm-realms

    Joined:
    Mar 24, 2014
    Posts:
    28
    Hi,

    Without using any transform.LookAt code, how is it possible for the TextMesh to always face the main camera?
     
    kiverisb likes this.
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    Considering your other (identical) thread offers a $40 reward I'm tempted to go there.
    Please refrain from posting clone threads.

    Code (CSharp):
    1.  
    2.   public Transform textMeshTransform;
    3.    void Update () {
    4.          textMeshTransform.rotation = Quaternion.LookRotation( textMeshTransform.position - Camera.main.transform.position );
    5.    }
     
  3. JoelMalone

    JoelMalone

    Joined:
    Apr 1, 2014
    Posts:
    7
    For a TextMesh I do this:

    someTextMesh.transform.rotation = Camera.main.transform.rotation;

    This renders the text facing towards the camera.
     
  4. Aspect13

    Aspect13

    Joined:
    Sep 29, 2018
    Posts:
    5
    Quite late... BUT THANKS GOD! I love you, was searching for it so long!
     
  5. MegDLT

    MegDLT

    Joined:
    Jan 20, 2024
    Posts:
    1
    So helpful, thank you!
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,576
    Please use the "Like" button to show appreciation so as not to necro threads. This thread is 10 years old.

    Thanks.
     
Thread Status:
Not open for further replies.