Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

changeable bones system

Discussion in 'General Discussion' started by Rhhs, May 22, 2023.

  1. Rhhs

    Rhhs

    Joined:
    Oct 12, 2013
    Posts:
    6
    Hello every one,
    I want to ask about the ability of making a part changeable bones system in unity.
    So I want to make a robot character (humanity or inhumanity), the user can change the robot parts, like arms or legs or what ever, these parts can be 2 or 3 bones parts.
    Also these parts is removable too, so if the player hold a robot part (in game mode) he can drag it away and the robot will react to this.
    Do you have any ideas on the best way to make this type of game. thanks in advance.
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,326
    If you're talking rigid robot parts that don't need any skin weights then you could simply parent whatever parts you want to the each bone.
    That's a completely separate problem. If you want a character to react to being dragged then you probably want an active rag doll system like this:
    https://assetstore.unity.com/packages/tools/physics/puppetmaster-48977
     
    Rhhs likes this.
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,317
    The easy way is making the robot use common skeleton, meaning all limbs will have same number of bones.

    If the parts are unique, well, this is gonna hurt.

    One way you could approach this is to have multiple animators per robot. It means separate animator for legs, and separate per each hand, and maybe one more for torso. This way you'll just attach parts to the body as prefab, along with animators.

    However, controlling the damn thing will be annoying, because you'll need to fire signals for animators, meaning for the robot body you could need todesign an animator that fires signals f or limbs. Completely abstract signals.

    Another possibility is making robot movements fully procedural. This will allow them to adapt to any combiantion of limbs, but it'll be harder to control and animations will be limited.
     
    Rhhs likes this.
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,326
    If you want humanoid robots and you want to use mecanim re-targeting it's also possible to build a humanoid avatar at runtime, although the APIs to do so don't seem to be well supported or well documented. I did find a github project that demonstrates how it can be done.

    https://github.com/bkevelham/unity-avatar-generation
     
    Rhhs likes this.
  5. Rhhs

    Rhhs

    Joined:
    Oct 12, 2013
    Posts:
    6
    Tank u @kdgalla @neginfinity for your help. i will search the the ways u explained here. Hoping customer accept to change his mind about these details :)
     
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,326
    It occurs to me that almost any game I've ever played that has customizable characters uses a single base skeleton for everyone. Skyrim, for example has switchable body parts in the form of armor pieces. but all humanoids have the same skeleton, even different races, as far as I know.

    I imagine this is because AAA games have a lot of animations and once you start changing peoples shoulder spans and arm lengths and whatnot then all of your animations are broken. You can mitigate this with IK, I guess, but that's probably a lot of work.
     
    Rhhs likes this.
  7. Rhhs

    Rhhs

    Joined:
    Oct 12, 2013
    Posts:
    6
    Yes that's right, really having a changeable skeleton system is very hard, thanks god the customer accepted to keep it as one skeleton with different skins :)
     
  8. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,317
    Spore. The creatures have unique skeletons, all body parts are optional, and number of limbs is user-defined.

    In case of unity games, there's mecanim, and that allows changeable body proportions. This is used with UMA system.

    A practical application for fully customizable skeleton would be Front Mission style games, where user drives mechs, but all parts are swappable. Meaning you could swap legs with threads, arms with rocket launchers and so on.

    I think this was actually implemented in Fallout 4 Automotron update. There you could swap legs with another chassis.
     
    Rhhs likes this.
  9. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    swapping out the models is one part of the problem but how they will be animated is probably the biggest part.
     
    Rhhs likes this.