Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"Opening" 2D circle at random positions

Discussion in '2D' started by Chilcone, Feb 20, 2017.

  1. Chilcone

    Chilcone

    Joined:
    Aug 25, 2014
    Posts:
    2
    I have a simple circle in my scene imported as Sprite that was made in Photoshop. What I'm trying to do is to make the circle open at certain positions on the circumference which are randomly calculated(second Picture).



    My initial idea was to take another sprite, make its color same as the background and place it over the circle. However, I cannot use this approach when I'm working with gradient and more complex backgrounds. Is there a way I could use a transparent object to cover part of an opaque object or any other approach so I would get the intended result?
     
    Last edited: Feb 20, 2017
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Brainstorming...
    1. You could draw your circle in a PixelSurface, and then easily erase bits of it as needed.
    2. If you can make your circle a UI element, you can easily use a Mask with it.
    3. You can maybe use the stencil buffer.
    4. ...Or you can try this sprite mask asset which manages the stencil buffer for you.
    5. Maybe you could use Vectrosity to draw just the arcs where you want them.
    Hopefully there's something in all that you can use!

    Good luck,
    - Joe
     
    vakabaka likes this.
  3. Chilcone

    Chilcone

    Joined:
    Aug 25, 2014
    Posts:
    2
    JoeStrout likes this.