Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Make TextMesh Face Camera

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

  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.    }
     
    ow3n, PNUMIA-Rob and Magiichan like this.
  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!