Combine Children flips normals if the scale is -1 -1 -1

Any work arounds?

Personally, I’d avoid using negative scaling altogether.

If that really isn’t an option, I think the simplest solution is fixing it during the combine stage: detect whenever you’re creating a CombineInstance for an object with negative scaling, make a copy of that object’s mesh, invert the winding order of the copy and put the copy instead of the original mesh into the CombineInstance.

the issue was with the ordering of triangles.
i changed the order of triangles for meshes with scale = -1,-1,-1 and it worked

another issue.

if i make a copy of the object (with the script), it doesn’t work.

I created two empty game objects.

g1->g2->gwindow
g1 has mesh combine script
g2 has following script.

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

	// Use this for initialization
	void Start () {
		//return;
			Component[] filters  = GetComponentsInChildren(typeof(MeshFilter));
		
		for (int i=0;i<filters.Length;i++) {
			MeshFilter filter = (MeshFilter)filters[i];
			Renderer curRenderer  = filters[i].renderer;
			Mesh m = filter.mesh;
			Transform t = curRenderer.transform;
		//	Debug.Log ( " x = " +  t.localScale.x  + " y = " +  t.localScale.y +" y = " +  t.localScale.y );
			if ( t.localScale.x < -0.9f  t.localScale.y < -0.9f  t.localScale.z < -0.9f  )
			{
			//	Debug.Log ("nverts : " + m.vertices.Length );
				
				int[] triangles = new int[ m.triangles.Length ];
				for (int j = 0;j < m.triangles.Length/3;j++)
				{
					int i1 = m.triangles[3*j];
					int i2 = m.triangles[3*j+1];
					int i3 = m.triangles[3*j+2];
					triangles[3*j] = i2;
					triangles[3*j+1] = i1;
					triangles[3*j+2] = i3;
				}
				m.triangles = triangles;

		
			}
		}
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

364468–12661–$bwindow_791.rar (7.11 KB)

If your mesh combine also runs from Start, there is no telling which will run first, the MeshCombine script or your script to reverse the triangle winding order. If the combine runs first, your winding script will not apply correctly. This is mainly why I suggested doing this from inside the combine script.

your theory seems to to correct.

can u plz point me to the doc which explains the order in which the scripts may run?

I don’t know any specific page about this subject, but the manual of Start seems to explain the main thing, Awake before Start: Unity - Scripting API: MonoBehaviour.Start().

There is no way to guarantee the order of Start functions of different scripts. This ordering should be considered random. While it may not always appear random in practice, depending on this order is asking for trouble.

If you need to make sure certain functions are always executed in a specific order, you should write your initialization functions and call those in the desired order from a manager script.

Thanks for quick resolution!