Closed zj831007 closed 6 years ago
I am very certain that this has to do with bindposes not being copied over automatically, seeing that you are simplifying a skinned mesh.
At this time you would have to do that manually.
Example:
void Start()
{
SkinnedMeshRenderer mr = this.GetComponent<SkinnedMeshRenderer>();
float quality = 0.5f;
var meshSimplifier = new UnityMeshSimplifier.MeshSimplifier();´
var bindposes = mr.sharedMesh.bindposes; // <--- This line
meshSimplifier.Initialize(mr.sharedMesh);
meshSimplifier.EnableSmartLink = true;
meshSimplifier.PreserveBorders = true;
meshSimplifier.SimplifyMesh(quality);
var destMesh = meshSimplifier.ToMesh();
destMesh.bindposes = bindposes; // <--- As well as this line
mr.sharedMesh = destMesh;
}
But I have to warn you that bone weights are not properly merged at the moment so you might experience holes and artifacts if the mesh is animated. This is something that I have planned to look into. But please post your results once you try what I posted above.
Could you please try out the latest release https://github.com/Whinarn/UnityMeshSimplifier/tree/v1.0.0 This should fix your issue as well as the issue I described above with bone weights.
@zj831007 Please confirm if this works for you or not.
I will consider this issue as being fixed and will now close this. @zj831007 Please re-open if you are still having issues with this.
I use as this:
public class TestSimplifier : MonoBehaviour {
} and the result is that, the simply mesh is rotation wrong, see the attach file: