Question by 
               Nucl3ear · Aug 16, 2017 at 09:48 PM · 
                c#vector3quaternionlookrotationtransformdirection  
              
 
              Look Rotation Viewing Vector is Zero
Hello there !
I have this little code there
 void OnTriggerStay2D (Collider2D other)
         {
             if (other.CompareTag ("Player")) {
                 target = other.transform;
                 target = GetComponent<Transform> ();
                 Aim ();
             }
         }
 
         void Aim()
             {
             Quaternion rotation = Quaternion.LookRotation
                 (target.transform.position - transform.position, transform.TransformDirection (Vector3.up));
             transform.rotation = new Quaternion (0, 0, rotation.z, rotation.w);
             }  
 
               So basicly the object should get the player and look at it but when it get in range i got the following error :
Look rotation viewing vector is zero
UnityEngine.Quaternion:LookRotation(Vector3, Vector3)
If anyone could help me to find the reason I would be very thankfull !
Have a good night / day! :)
EDIT : I forgot to mention that target is declared before as a private Transform.
               Comment
              
 
               
              Hey there ! Little up ? I didn't found my answer but keep trying...
Thank you !
Your answer
 
             Follow this Question
Related Questions
How to use Random.rotation inside a vector 3? C# 1 Answer
Smoth LookAt Unity c# 0 Answers
Quaternion lerp slowing down movement? 1 Answer