Search Unity

Use Line Renderer to Sweep Out an Area

Discussion in 'General Graphics' started by xorpheous, Sep 3, 2019.

  1. xorpheous

    xorpheous

    Joined:
    Mar 28, 2018
    Posts:
    19
    Is this even possible with the Line Renderer component? I'm working on building a tool to demonstrate Kepler's Three Laws to my Astronomy class while simultaneously using some techniques that I can demonstrate to my Game Physics class. What I'd like to achieve is to have a line from my central object to my orbiting object sweep out an area resulting in a wedge shape as per something akin to the image below.


    Getting the line from the central object to the orbiting object using the Line Renderer component is easy. Getting that line to sweep out a wedge of area is not as easy for me. I can create a thin object and scale and rotate it dynamically between the central and orbiting objects and then use the Trail Renderer component, but that seems rather cumbersome. I thought surely there was a simpler method I wasn't seeing.
     
  2. MegamaDev

    MegamaDev

    Joined:
    Jul 17, 2017
    Posts:
    77
    Filled area, eh? Probably want to look at procedural mesh generation. If you're drawing the outline via the Line Renderer, it should be a simple matter of passing the line's points in as geometry...or, well, simple once you figure out how triangles work.

    I dunno, maybe there's a simpler method, but I don't think it's possible to do what you're after with a line renderer.
     
  3. xorpheous

    xorpheous

    Joined:
    Mar 28, 2018
    Posts:
    19
    After beating my head against the wall for a while with the Line Renderer, I gathered that it wasn't the tool for the job, but not being a graphics guy, I wasn't sure what the right tool/direction was. Thanks for the heads-up about mesh generation. That may be what I'm after.
     
  4. xorpheous

    xorpheous

    Joined:
    Mar 28, 2018
    Posts:
    19
    MegamaDev and richardkettlewell like this.
  5. MegamaDev

    MegamaDev

    Joined:
    Jul 17, 2017
    Posts:
    77
    You're welcome. Glad I could help~ :)
     
    xorpheous likes this.