Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Can I create a 'hole' in a sprite geometry using the PSDImporter/2DAnimation packages?

Discussion in '2D' started by bradford, Sep 22, 2021.

  1. bradford

    bradford

    Joined:
    Jan 20, 2013
    Posts:
    6
    I'm moving away from Anima2d towards 2DAnimation. One feature in Anima2D that I haven't yet found in 2DAnimation is the option to create a 'hole' in the sprite's geometry.

    Anima2D had a 'hole' button, and, here was the user manual blurb:

    "Add holes: Sometimes you may want to avoid showing a part of the mesh in your game. To do that you can use a hole, which you can add to an enclosed area by pressing the Hole button and then double-clicking at the place you want to add the hole to"

    Does 2DAnimation have any equivalent? Specifically, I'd like to create a hole *AFTER* the auto-geometry does most of the grunt-work for me. For example, imagine a smaller circle cut out from the inside of a larger circle (topologically equivalent to a 2d donut, for example).

    I'm not seeing an option to do this in the UI. Am I missing something in the UI, or is this a missing feature? if it's missing, is it planned for a future release?
     
    Last edited: Sep 22, 2021
  2. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    832
    Hello,
    You can add vertices and later edges to create a hole in a mesh. See this example I setup:


    Here I first added 4 vertices using the Create Vertex tool in the Skinning Editor, and then the Create Edge tool to connect the 4 vertices with each other.

    Let me know how it goes!
     
  3. bradford

    bradford

    Joined:
    Jan 20, 2013
    Posts:
    6
    Thanks Ted, interestingly I'm having a rather different outcome when I try that. For example, starting from here:

    upload_2021-9-23_19-19-58.png

    I'll use the 'Create Vertex' tool to create four vertices:

    upload_2021-9-23_19-21-1.png

    then when when I create the edges, the central 'hole' remains filled:

    upload_2021-9-23_19-22-13.png

    Am I following a similiar process to you? or is there something nuanced that I'm missing?

    I'm using 2DAnimation Version 6.0.5, not sure if I need to use v7.

    Thanks for your help!
     
  4. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    832
    Sorry for the confusion. In Unity 2021.2 (2D Animation 7.x), we swapped out our triangulation & tessellation module in the 2D Animation package, which now allows for holes in meshes.
    So bump your project to 2021.2 if you want to give this a try.
     
  5. bradford

    bradford

    Joined:
    Jan 20, 2013
    Posts:
    6
    Switching to 2021.2 is no problem for me. Thanks for the clarification!
     
    Ted_Wikman likes this.
  6. pinkhair

    pinkhair

    Joined:
    Dec 17, 2010
    Posts:
    141
    I hadn't thought to test it when I tried the newer 2d animation- will a sprite that has closed areas of edges from a previous version have holes in it when moved to 7.x? Or will that only be for meshes created in the new version of the editor?
     
  7. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    832
    You need to recreate the mesh in Unity 2021.2 (2D Animation 7.x) for the holes in the mesh to appear.
     
    pinkhair likes this.