Search Unity

Question how can i make a quad oriental to the camera(view direction)?

Discussion in 'Shader Graph' started by shibi2017, Mar 11, 2020.

  1. shibi2017

    shibi2017

    Joined:
    Jan 18, 2018
    Posts:
    153
    i wonder if i can make a quad/mesh towards the camera/view always,and I caculate three rotations in three axis:
    upload_2020-3-11_16-58-49.png
    That's what i do in shader graph. i know is a silly way, but this is one i can image.
    The three branches on right is the rotation.x, rotation.y and rotation.z.

    And when i apply it to the rotate-vector3 function(the function is in the following image),sth goes wrong. upload_2020-3-11_17-0-34.png

    I found that the rotation on X axis is right, but when it comes to Y axis, only half of 360 degrees is right.
    in this image, quad rotates rightly: upload_2020-3-11_17-4-21.png

    and in this situation, it goes wrong, and the rotation totally oppsite. upload_2020-3-11_17-4-45.png

    no matter if i use a 2*PI to subtract it or not, this strange problem happpens still.

    English is not my first language, thank you for your patience!
     

    Attached Files: