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

Parallel LookAt

Discussion in 'Scripting' started by UnityLighting, Dec 4, 2016.

  1. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,778
    Hi
    I'm not experienced in Math programming in unity and have a problem in Unity LookAt function.
    I'm used simple LookAt function to face lens flare textures to camera. But in AAA game you can see lens flares are face to camera in parallel.
    How can i do that in unity?
    Thank you.
    a58328a2-1b8a-43ad-bda5-b68c18a3ba4b_scaled.jpg
     
  2. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    You need to use the version of LookAt that also specifies the up vector, like this:

    transform.LookAt(camera.transform.position, Vector3.up);
     
  3. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,778
    Thank you. But nothing changed.
     
  4. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    Just set the rotation of flare to the rotation of camera.
    If needed rotate 180 degrees around local Y
     
    UnityLighting likes this.
  5. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,778