Quantcast
Channel: Questions in topic: "skinned mesh renderer"
Viewing all articles
Browse latest Browse all 192

MeshSmoother with SkinnedMeshRenderer

$
0
0
edit: had to fix a weird double-post I was trying to use the code from [MeshSmoother from Wiki][1] on a SkinnedMeshRenderer instead of MeshFilter - however I run into some problems. First I had several 'object reference not set to an instance' messages when I replaced MeshFilter with SkinnedMeshrenderer and .mesh with .sharedmesh. If I understand correctly, SkinnedMeshRenderer doesn't allow for .vertices operations?
Right now I tried adding .BakeMesh, and while there's no error messages I'm not sure how to re-apply a new mesh to the renderer or even how to see if the code is doing anything to the input mesh. Current code below (the only change is for the TestSmoothFilter.cs): void Start() { Mesh meshfilter = new Mesh(); gameObject.GetComponent().BakeMesh(meshfilter); // Clone the cloth mesh to work on sourceMesh = new Mesh(); // Get the sourceMesh from the originalSkinnedMesh sourceMesh = meshfilter; // Clone the sourceMesh workingMesh = CloneMesh(sourceMesh); // Reference workingMesh to see deformations // Apply Laplacian Smoothing Filter to Mesh int iterations = 1; for (int i = 0; i < iterations; i++) workingMesh.vertices = SmoothFilter.laplacianFilter(workingMesh.vertices, workingMesh.triangles); //workingMesh.vertices = SmoothFilter.hcFilter(sourceMesh.vertices, workingMesh.vertices, workingMesh.triangles, 0.0f, 0.5f); meshfilter = workingMesh; }
I guess my question is - **how can I access vertices for SkinnedMeshRenderer? Or if I need to use BakeMesh, how can I apply a new mesh to a current SkinnedMeshRenderer to see changes?** [1]: http://wiki.unity3d.com/index.php?title=MeshSmoother

Viewing all articles
Browse latest Browse all 192


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>