10-08-2013, 10:19 PM
Hi there,
I'd like to make a feature request to add "Reverse Winding" to the triangle generation routine of SplinePathMeshBuilder.
This helps with creating meshes where the inside surface can be rendered and used with Mesh Colliders, instead of the outside surface. This is useful, for example, when you're extruding a tube for the player to travel inside of.
I can currently easily modify the Curvy code to accomodate this but I'd rather not have to re-modify Curvy code after each update, and I think this might prove useful to other users of Curvy as well.
Here's how I achieved Reverse Winding in code:
Add property at the top of SplinePathMeshBuilder:
Add @ line 646 in SplinePathMeshBuilder:
Replace the for loops @ lines 653 and 675:
Thanks!
I'd like to make a feature request to add "Reverse Winding" to the triangle generation routine of SplinePathMeshBuilder.
This helps with creating meshes where the inside surface can be rendered and used with Mesh Colliders, instead of the outside surface. This is useful, for example, when you're extruding a tube for the player to travel inside of.
I can currently easily modify the Curvy code to accomodate this but I'd rather not have to re-modify Curvy code after each update, and I think this might prove useful to other users of Curvy as well.
Here's how I achieved Reverse Winding in code:
Add property at the top of SplinePathMeshBuilder:
Code:
public bool ReverseWinding = false;
Add @ line 646 in SplinePathMeshBuilder:
Code:
int[] indexOffset = ReverseWinding ? new int[] {0,2,1,3,5,4} : new int[] {0,1,2,3,4,5};
Replace the for loops @ lines 653 and 675:
Code:
mTris[triIndex + indexOffset[0]] = vtSegN+ev;
mTris[triIndex + indexOffset[1]] = vtSegN1+ev;
mTris[triIndex + indexOffset[2]] = vtSegN1 +1+ev;
mTris[triIndex + indexOffset[3]] = vtSegN1 + 1+ev;
mTris[triIndex + indexOffset[4]] = vtSegN + 1+ev;
mTris[triIndex + indexOffset[5]] = vtSegN+ev;
Thanks!