Browse Source

PolyEditor: Always keep polygons clockwise

trethaller 6 years ago
parent
commit
8468f650bf
1 changed files with 3 additions and 0 deletions
  1. 3 0
      hide/prefab/PolygonEditor.hx

+ 3 - 0
hide/prefab/PolygonEditor.hx

@@ -201,6 +201,9 @@ class PolygonEditor {
 	}
 	}
 
 
 	function refreshPolygon(){
 	function refreshPolygon(){
+		if(!polygonPrefab.points.isClockwise())
+			polygonPrefab.points.reverse();  // Ensure poly is always clockwise
+
 		var polyPrim = polygonPrefab.generateCustomPolygon();
 		var polyPrim = polygonPrefab.generateCustomPolygon();
 		var mesh : h3d.scene.Mesh = cast getContext().local3d;
 		var mesh : h3d.scene.Mesh = cast getContext().local3d;
 		mesh.primitive = polyPrim;
 		mesh.primitive = polyPrim;