Question by 
               F3RILLA · Oct 25, 2018 at 09:24 PM · 
                rotationraycast2d-physicsraycasthit2dlinecast  
              
 
              Raycast2D 360 Rotation
Hi Everyone,
I am trying to shoot a raycast from a gameobject which rotates but I am having issues creating the raycast end point. I have tried using COS and SIN but no luck. This is the effect I want to achieve:

This is the script I have written so far:
     // Raycast Start Point
     Vector2 StartPoint = AimStartPoint.position;
     // Raycast End Point
     Vector2 EndPoint = AimEndPoint.position; 
     // Create and Cast a Raycast Upwards
     RaycastHit2D Hit = Physics2D.Raycast(StartPoint, EndPoint);
     // Check if Ray Hit Something
     if (Hit)
     {
         Debug.Log(Hit.transform.name);
     }
     // Draw Raycast
     Debug.DrawLine(StartPoint, EndPoint, Color.red);
 
               Could someone please share their ideas or tips how I can make this work without using a gameobject as an endpoint, I want the raycast to rotate around the scene and hit every gameobjects around it.
 
                 
                ezgif-3-665940418f05.gif 
                (148.2 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Hookshot in Unity 2D not working,Hookshot 2D not working 0 Answers
Linecast ignores obstacles. 0 Answers
One 2D Raycast Not Stopping Even Though Others Do? 0 Answers
Raycast not detecting bullet 0 Answers