Skip to content
This repository was archived by the owner on Feb 11, 2024. It is now read-only.
This repository was archived by the owner on Feb 11, 2024. It is now read-only.

Welding seems broken #247

@vverdier

Description

@vverdier

I got this exception after performing a welding operation:
IndexOutOfRangeException: Index was outside the bounds of the array.

The exception is thrown by GetPrimaryPolygonDescribers() in SurfaceUtility.cs
From what I understand, the code is unable to find 3 non-colinear vertices because it is given 4 vertices at the same location.
(Btw, I think this code could be improved to be more robust by using an intermediate variable in the for-loop instead of using the variable vertexIndex3)

Steps to reproduce:

  • Create a box
  • Go to vertex editing mode
  • Weld 4 top vertices togheter using 'Weld selection to Mid-Point'
  • Go to face editing mode
  • Select the object in the hierarchy in order to select all the faces

ezgif-4-b0ea9a9dee91

[EDIT] I use Unity Version 2019.4.1f1 (LTS)

[EDIT2] After some debugging, it seems we never remove any polygon in EndWeld() because the method TryRemoveExtraneousVertices() doesn't allow polygons with less than 3 vertices. It makes sense because this is the definition of a polygon... but this is inconsistent with the final phase of EndWeld() that expects this behaviour (there is a comment that says 'remove faces that now have < 3 vertices')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions