Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mesh.CombineMeshes() on SkinnedMeshes ?

Discussion in 'Editor & General Support' started by n0mad, Oct 1, 2010.

  1. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Hello,

    Can't check it because I'm at work now, but does CombineMeshes() actually work with skinned meshes ?
    If yes, does it respect the bones indexes and everything ?

    I wrote my own SkinnedMeshCombiner some long time ago, but I guess Unity will always do it better, so I'd be pretty interested in it.

    Thanks
     
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Yes, it will. However, it kind of depends on what you want to do with the combined skinned meshes, if the results are what you want. It will create a mesh with the assumption that each source mesh reference separate bones, so, if you enter mesh A with 2 bones, and mesh B with 3 bones, the resulting mesh will reference 5 bones, and you will have to set up the bone array in the SkinnedMeshRenderer to refer to all the bones for mesh A, and then all the bones for mesh B. This may or may not be what you want, depending on your application - if you want the meshes to share a bone structure, you may be better of still rolling your own.
     
  3. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Thank you for your answer :)

    To be more precise : I have 3 meshes that all share the base skeleton (3 instances of the same bone hierarchy).

    So I'm planning to combine meshes, and then import the skeleton, and then just pointing the combined mesh bones to this new name-matching imported skeleton.

    Bone array pointing is not very resource hungry, so this solution is perfect and should save great amounts of loading times compared to my home function.

    Thanks !