Search Unity

Question My Mesh drawn with the mouse is 2D

Discussion in 'Scripting' started by OzgurOzdemir24, Mar 1, 2021.

  1. OzgurOzdemir24

    OzgurOzdemir24

    Joined:
    May 1, 2018
    Posts:
    9
    Hello, I found a Japanese source and made a mesh drawn with a mouse. But while this was 3D for the person I watched his training with, it became 2D for me. I saw a note at the bottom, but I didn't quite understand it. Can you help me?



    Japan Reference; https://daichi-no.blog/3d-cube-mesh-with-mouse/

    My;

    upload_2021-3-1_3-2-35.png

    My Code;


    Code (CSharp):
    1. Drawline
     
  2. OzgurOzdemir24

    OzgurOzdemir24

    Joined:
    May 1, 2018
    Posts:
    9
  3. Putcho

    Putcho

    Joined:
    Jun 1, 2013
    Posts:
    246
    Since it is not your original code, it will be difficult for you depending on how much you understand it.

    You have to clone all the vertices and move them in the thickness direction on top of that you have to reordering the triangles in the opposite clockwise or flip the normals. then you are going to have extra more vertices to do the side way stitching between 2 planes.
     
  4. OzgurOzdemir24

    OzgurOzdemir24

    Joined:
    May 1, 2018
    Posts:
    9
    Oh Do you give me example?
     
  5. Putcho

    Putcho

    Joined:
    Jun 1, 2013
    Posts:
    246
    you can training yourself by create a simple plane with 4 vertices and turn it into a box with final result 24 vertices.

    i gave you homework, try to make a box out of 4 vertices, if you can do that, then gg
     
  6. Putcho

    Putcho

    Joined:
    Jun 1, 2013
    Posts:
    246
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    I have some procedural examples in my MakeGeo project. There's even one called
    Extrude2DShape
    !

    https://github.com/kurtdekker/makegeo/blob/master/makegeo/Assets/makeextrusion/Extrude2DShape.cs

    Full use case set up in the
    testmakeextrusion.unity
    scene, showing a 2D letter K getting extruded into 3D with separate materials for front, back, sides.

    MakeGeo is presently hosted at these locations:

    https://bitbucket.org/kurtdekker/makegeo

    https://github.com/kurtdekker/makegeo

    https://gitlab.com/kurtdekker/makegeo

    https://sourceforge.net/p/makegeo
     
    Putcho likes this.