Search Unity

Probuilder: How add edge loop at runtime

Discussion in 'World Building' started by Tarrag, Dec 5, 2019.

  1. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    Hi,
    How can I select an edge loop on obj with script?

    I see no example or reference in the documentation

    Thank you for your help
     
    Last edited: Dec 6, 2019
  2. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Sorry I can´t help you here.

    I have a similar problem, I want to pick an edge or a vertice at runtime (no rectangular selection) and don´t have any option to do so. Picking a polygon on the other hand is provided and works fine.
    Is it something we have to code on our own?
     
  3. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    hey @Cascho01 , I could pick a vertex to translate it with this although didn't give me the desired results for my purposes. I'm not sure what you mean by rectangular section, cheers
    Code (CSharp):
    1. //pick face
    2. Face sourceFace = pb.faces[0];
    3. var v = sourceFace.distinctIndexes;
    4.  
    5. //take face vertices into array
    6. int[] verticesArray = new int[4];
    7.         for (int i = 0; i < v.Count; i++)
    8.             verticesArray[i] = v[i];
    9.  
    10. //pick vertex bottom right in my case
    11. int[] bottomRight = { v[0] };
    12. pb.TranslateVertices(bottomRight, new Vector3(0.2f, 0.2f, 0f));
     
  4. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Thanks but I mean how to pick a vertice or edge by mouseclick.
    Rectangular selection is when you draw a 2d-rectangle on screen with mouse to select multiple objects which are inside this rect....
     
  5. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    Ah got'cha, I'm dunno, i model outside unity if i were to do it on editor. In this case I'm after runtime modeling