- Home /
Question by
noxerr94 · Sep 19, 2016 at 06:17 PM ·
animationblendshapesskinning
Transfer blendshapes between objects
I have two gameobjects with skinned mesh renders, both meshes have the same uv's and topology and so on and I want to transfer blendshapes from one mesh to another but I can only find the way to add a frame. Is there any way to transfer those blendshapes like I do with the bones?
pd: I've seen unity haven't implemented yet add/get blendshape function, is there any api that does so?
Comment
I did something like that so the blendshapes are transfered but they do nothing on the new avatar:
Vector3[] vertexAux, normalsAux, tangentsAux;
vertexAux = new Vector3[aux.vertexCount];
normalsAux = new Vector3[aux.vertexCount];
tangentsAux = new Vector3[aux.vertexCount];
for (int i = 0; i < templateRenderers[j].shared$$anonymous$$esh.blendShapeCount; i++)
{
for (int jj = 0; jj < aux.GetBlendShapeFrameCount(i); jj++)
{
aux.GetBlendShapeFrameVertices(i, jj, vertexAux, normalsAux, tangentsAux);
scanRenderer.shared$$anonymous$$esh.AddBlendShapeFrame(aux.GetBlendShapeName(i),
aux.GetBlendShapeFrameWeight(i, jj), vertexAux, normalsAux, tangentsAux);
//scanRenderer.shared$$anonymous$$esh.AddBlendShapeFrame(aux.GetBlendShapeName(i), aux.GetBlendShapeFrameWeight(i, 0), aux.GetBlendShapeFrameVertices());
}
}