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

Best way to animate character composed of multiple meshes?

Discussion in 'iOS and tvOS' started by GamingHorror, Sep 4, 2009.

  1. GamingHorror

    GamingHorror

    Joined:
    Sep 4, 2009
    Posts:
    9
    Imagine some human characters which should be able to have different heads, different arms, different legs in any combination imaginable and all are supposed to be animated with the same skeleton.

    What would be the best way to go about this in Unity? I don't care so much about performance since i only want to have two characters on the screen, eg. like in a Box fight. No fancy 3D background or anything so it's ok if 80% of the rendering time goes into those two characters.

    As far as i've seen all information in the manual or forum only talk about skeletal animations of a single mesh. Not skeletal animation of a character which is composed of several meshes.

    I would imagine that i could render the meshes myself by transforming them depending on the transform of the bone they are supposed to be attached to. Is this possible, and is this the only way to do this? Are there some automatisms i can rely on? Should i approach this completely differently?

    Needless to say i'm new to Unity and i don't actually do 3D modelling and animation so i can't easily try this out. I appreciate any help pointing me in the right direction!
     
  2. GamingHorror

    GamingHorror

    Joined:
    Sep 4, 2009
    Posts:
    9
    Bump.

    In case what i wrote is hard to understand, please let me know.
     
  3. GamingHorror

    GamingHorror

    Joined:
    Sep 4, 2009
    Posts:
    9
    Looking at a number of other games and remembering some conversation i had with artists ... i think i'm going the wrong way, right?

    Now i'm thinking to rather use more single-meshes each with it's own boned animation to up the diversity, and then "decorate" them by replacing materials or simply adding/removing "stiff" attachments (spikes, antennae, etc) to certain bones.

    No way i look at it will replacing parts of a boned animation (eg. fully replacing a leg, arm, or chest) work. About the only thing that would work is to model a human without the head and then adding the head as an attachment, since it doesn't move as flexibly as arms and legs do (well of course that is unless he gets a facepunch but that is a different issue *G*).

    Does that sound more realistic?
     
  4. n0mad

    n0mad

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

    I'm precisely doin that thing in the game I'm developping.

    You just need to create as many FBX as your models has different parts, each one containing exactly the same skeleton structure.
    Those FBX will have no animation, just the skeleton and the body part.

    In another separate FBX, you will include only the bone, with its proper animations.

    Then in Unity, you would first make a script that combine all the body parts together (try a search with "combine skinned mesh"), and then you would bind this mesh to your animated skeleton.

    That works fine for me, being able to load different heads, haircuts, bodies and clothes.
     
  5. GamingHorror

    GamingHorror

    Joined:
    Sep 4, 2009
    Posts:
    9
    Thanks, i'm reading this now, sounds promising!
     
  6. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Thank you.

    Let me show you this script, which is the main inspiration I had for such a feature, thanks to Gabriel Santos.

    I used the word inspiration because each game has too specific parameters, like how many parts to add, how can we bind the skeleton, how could we manage animation sharing, etc ... So we can't have a solid universal script for that purpose.
    But at the end, it's not that hard, considering the hardest part is to correctly translate models coordinates from FBX to the final combined mesh.


    Good luck ;)