Search Unity

Creating a circle as range of the turret

Discussion in '2D' started by unity_Z70jaPTIIp7DuQ, Mar 23, 2018.

  1. unity_Z70jaPTIIp7DuQ

    unity_Z70jaPTIIp7DuQ

    Joined:
    Jan 20, 2018
    Posts:
    8
    Hello.
    As the title says, I want to create a circle that would represent range of the turret (radius would be it's colder)

    I found one solution how to create a circle, bit I have no idea how that works. Could someone please explain? I have never worked with line renderer so far.

    https://forum.unity.com/threads/linerenderer-to-create-an-ellipse.74028/

    I just want to understand how that works and then implement it to my game

    Thank you!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Just attach that script to a GameObject that also has a LineRenderer component. The script uses a bit of trigonometry to calculate the points on the line that approximate a circle.