Search Unity

To Use physic on several characters bones question

Discussion in 'Physics' started by mr_Necturus, Dec 4, 2017.

  1. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Hey Guys.

    I created warrior character with skirt.
    The skirt is one object but actually present 18 armored leather strips.

    This strips have to move independently, so each strip skinned to its own personal bone. (As you can see on video)


    I provide many animations with this character. But I don't want to animate those strips.
    There are 2 reasons for this:
    1. It is much boring work.
    2. If someone will want to use extra animations with this warrior, say from animation collections found on Unity Market, the strips will no be animated.

    Physic solve both problems.

    Is here a way to make something like I am looking for?

    I will be grateful for tips and explanations.
     
  2. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723


    Perhaps you should fix the video you posted 30 mins ago first...
     
    mr_Necturus likes this.
  4. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Sorry, forgot to public the video.
    Now it is visible?
     
  5. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Here I tried to make same setup like in tutorial. But physic didn't work.
    Maybe I miss something small?

     
  6. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    No solution, no help... :(
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well it's basically the problem is you're not really familiar with physx. I'm guessing you want the leg to move the clothing, so you can either paint the clothing bits as stiff cloth, or you can go with this current solution but joints are a nightmare to set up in Unity (it's considerably easier in UE4 to make sense of them plus dedicated animation joints) so in Unity you need to be looking at how ragdolls are set up. It's a similar thing I guess.

    In my game, I coded secondary motion manually and it works - kind of, still need to get it working on other axis :)

    I hope someone can chip in with some knowledge of a basic joint set up - perhaps @Partel-Lang feels charitable? He's one of the best of the best at this stuff!
     
  8. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Thank you!

    Actually stiff cloth if it will may be stiff as leather or metal will work for me.
    I will try it.

    I have much experience with rigid bodies and clothes physic in MAX or Maya. I even worked with Syflex - most successful clothes plugin for Maya 15 yeas ago. )



    So I know pretty well how all generally works.
    I don't familiar what things I need to tweak in Unity in order things will work properly or will work at all. )
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    All you do is add cloth component direct to the mesh you desire, then colliders - its straightforward but fiddly. It's good for performance as people fade it out after. This is ideal (or physics are ideal) if the anims will be changing. I guess you have clothing as a separate object? It doesn't matter to cloth which can go on skinned or separate objects.

    https://docs.unity3d.com/Manual/class-Cloth.html
     
    mr_Necturus likes this.
  10. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Thanks!

    Yes, I made skirt as separate object because planned to use physic with it.
    I will test it soon when I have free time and public result here.
     
  11. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Hm... Thank you for help hippocoder.
    The result far from ideal so far. At least in Unity 5.1
    It seams I will prefer to create animations for skirt by hand.
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Using physx or cloth for attachment-type things is not optimal, it's the reason I developed my own joint physics and the reason UE4 and other engines have a dedicated physics animation library, so you can do these things faster and easier.

    Using physx was always going to be a problem for you (your first approach) because:
    - people use different physics settings than you
    - people have layers set up different to you

    Using cloth is still feasible but you have to be really fiddly with it and cloth only improves in newer beta.
     
  13. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    I agree. But here is my point why I decided to stick with handmade key animations in first release.

    1. It gives maybe not very realistic but still suitable result.
    2. This approach don't need fixes in later Unity versions if something will be changed in physic engine.
    3. If someone will want to use external animations, he can do it by creating his own physic setup. So I will not be responsible for wrong or strange physic behavior.
    4. Once when physic will looks better I can also create physic model setup if I want.
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Now if only Unity was working on jiggle bone physics :rolleyes:
     
  15. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Here is result of hand made skirt animation (2,5 days work).
    Looks closer to realistic view then clothes physic, for my opinion.