raycast : get normal value of linecast hit
Hello,
i'm trying to get the normal value of a linecast hit and i don't understand why i'm not getting the normal but kind of random angle.
the red line is the line i cast the blue line should be normal of the hit object (green line is a edge collider)

  void RaycastLiana()
     {
         //DRAWRAY
         Debug.DrawLine(startRay.position, endRay.position, Color.red);//draw a line between start transform and end
         lineCastLiana = Physics2D.Linecast(startRay.position, endRay.position,1<<LayerMask.NameToLayer("liana"));//raycast between start and end and return if layer is Liana
                 Debug.DrawLine(lineCastLiana.point, lineCastLiana.normal*3f, Color.blue);//normal raycast angle of collided ground
 
         if (lineCastLiana.collider != null)
         {
             collidedObjet = lineCastLiana.transform;//to get the name of the collided gO
             rbLiana = collidedObjet.GetComponent<Rigidbody2D>();
             Debug.Log("FROM raycastLiana: collided object is : "+collidedObjet+"and rb is :" +rbLiana);
             lianaCollided = true;
         }
         else
         {
             lianaCollided = false;
         }
     }
 
               thank you
 
                 
                captureclimb.jpg 
                (48.3 kB) 
               
 
              
               Comment
              
 
               
              Answer by Clevereen · Jul 13, 2018 at 03:28 PM
I've add a radius to the edge collider and worked….weird!
Your answer