- Home /
Character Customization demo - Problem with scaling and rotation
I'm trying to export from 3DSMax a new character to be used within the Character Customization demo (Dressing Room).
I'm using the same naming convention than the demo and it partially work.
My problem is that after running the scripts, the scaling of my models and rotation are lost somewhere in the process. I can force back the good rotation of my export in the scripts after the "CombineMesh" method, but forcing the scale does not seem's to work (scaling is 1 instead of 0.01).
In the original Max scene, the unit is actually in cm (and it's in meters in the engine).
Note1 : If I instanciate directly my object from the project to the hierarchy (drag to the scene), the scaling and rotation are perfect.
Note2 : An error is broadcasted into the engine while playing : "Number of bind poses doesn't match number of bones in skinned mesh". Could be related. The artist I am working with is trying to fix this error in the original Max scene.
Any help will be welcomed,
Nicolas
Answer by Nicolas 1 · Oct 14, 2010 at 06:06 PM
Partial solution :
I found the scaling issue : there was a texture with a name mistmatching the matching mesh name section.
I did not receive any error message while starting the game and it was impossible to scale the combined mesh as a result of the texture name mismatch. I found the error after looking at the final combined mesh and seing that there was a transparent section at the mesh position.
I still have an issue with rotation, so I modified the code in CharacterGenerator.cs to copy the original rotation transform and apply it back to the combined mesh.
// Obtain and configure the SkinnedMeshRenderer attached to
// the character base.
SkinnedMeshRenderer r = root.GetComponent<SkinnedMeshRenderer>();
r.sharedMesh = new Mesh();
r.sharedMesh.CombineMeshes(combineInstances.ToArray(), false, false ); r.bones = bones.ToArray(); r.materials = materials.ToArray();
// New : Re-apply the rotation from the original model // that you can get from any characterelement used. r.transform.rotation = qRotation;
Nicolas
Finally for wahtever reason, the scaling issue re-appeared in the scene, so it might be something else.
I'm suspecting the error :
"Number of bind poses doesn't match number of bones in skinned mesh". to be related with this issue.
Answer by Loius · Oct 31, 2010 at 03:54 PM
"Number of bind poses doesn't match" means your instanced object needs to be destroyed and re-created. It no longer has the exact set of bones required by the animated mesh. It sucks, but it happens every time the bone layout changes in an external program - all in-game instances have to be recreated.
Your answer
Follow this Question
Related Questions
3DMAX export FBX file, rotation always error 6 Answers
Advanced character customization 6 Answers
Understanding a Character 1 Answer
Character Creator: changeing the Mesh. 1 Answer
Character Rotation - Script not functioning correctly 1 Answer