Search Unity

Procedurally Generated mesh using Vive controller drawing triangles backward. Help needed

Discussion in 'General Graphics' started by KyronxLK, Apr 2, 2019.

  1. KyronxLK

    KyronxLK

    Joined:
    Jul 5, 2015
    Posts:
    1
    In unity I'm creating a brush like prefab that creates a procedurally generated mesh, it takes vectors from the controllers position and creates a shape using them using indices to create the triangles that connect them.

    The idea is when you move the controller you've created a 3d mesh. However the issue im getting is that when the controller is moved backwards (-z) the triangles are drawn inside out as I assume the indices are now considered to be drawing the triangle in a way that flips them. I've tried generating indices backwards when the controller moves backwards, but unfortunately the triangles aren't always drawn inside out when the controllers direction is x,y,-z.

    from left to right: first is what it should look like, second is what it does look like now
    image.png