Search Unity

Stretch bones with Humaniod

Discussion in 'Animation' started by wojtek_bilinski, Jun 17, 2014.

  1. wojtek_bilinski

    wojtek_bilinski

    Joined:
    Jun 17, 2014
    Posts:
    1
    Hello,

    I'd like to ask if Unity will support stretch bones (or bones translation) within Humanoid animation system? I know I can do it with legacy now, but it's impossible with Humanoid in 4.x version. Maybe in 5.x versions ?
    Thanks.
    Greets.
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Hi,

    it's in the roadmap, maybe in 5.x release cycle but certainly not for 5.0 or 5.1 since we haven't begin to work on this yet.
     
  3. Larb

    Larb

    Joined:
    Feb 17, 2013
    Posts:
    20
    Hi Mecanim-Dev, do you have an updated timeline for stretchy bones with humanoids, i can't find it on the roadmap.

    Cheers!
    Lars
     
  4. Larb

    Larb

    Joined:
    Feb 17, 2013
    Posts:
    20
    Is it under the update:
    "Animation: AnimationPlayable.ProcessAnimation
    Generates poses in Playable graph. This will allow user to write custom IK, prodedural animation, live mocap, bones-based mixer etc."
    That sounds super interesting, I can't wait to try it out.
     
  5. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hey just wondering if anything ever came of this? I had a bunch of stretchy animations in my last game using legacy animation system and they really looked great, I’d Love to add some in the new system but I can’t seem to get anything to work. Also all of the posts I can dig up seem to years old.
    Any ideas?
    Thanks,
    Pete
     
  6. DChap

    DChap

    Joined:
    Dec 24, 2016
    Posts:
    23
    Just adding to this, I would also be interested if this has been solved yet, or there is any workaround? Unity and stretchy bones do not seem to mix well from the many things I've tried (I can get it to work, but weird, buggy things happen anytime I apply stretch animations to a bone) and Humanoid seems to straight up not allow it.

    Having bone stretch is crucial to my project so I'd love if anyone had some tips on how to make this work.
     
  7. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824

    I had a bit of a muck around today and got something working. It has issues with bones further down the hierarchy since their scale is added together.
    Basically I've exported an extra null for every bone that needs to be scaled with the scale animation data embedded in the null's scale, then in unity I'm running a script in LateUpdate that applies those scales to the bone scale.
     
  8. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    @petey this is quite interesting, as i'm looking at whether there's a way to get bone scaling in Mecanim. my main tools i'm dealing with are Daz and Blender, not Maya or 3DS Max so i don't know what you were using. up until now i've been using Legacy anims for situations where the stretching/expanding is required and just swapping out models but i expect they will eventually drop Legacy support. however it would also be nice to have both stretching and retargeting available.

    i'm curious how this script is applied. are you checking on the Animator State and gradually applying bone scaling that way as the clip is playing? and yeah i know about the propagating of scale down the chain where you have to compensate for that by shrinking bones further down - not too fun.
     
  9. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hey @metaphysician, I can’t quite remember, I’ll try and dig the old file up. I think I might have been re applying the bone scale in late update. It’s a long weekend here but I’ll see what I can find and get back to you because it would be really nice to be able to use.
    You can see in my gif that the foot is scaling a bit oddly too.
     
  10. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    thanks! i'm kind of wondering if it might be something related to in-game body sliders except more automatic and directly synced to animation position. in my case i'm more interested in Timeline integration rather than interactive movement under player control. was wondering if tweening could help, but i think that sets up parallel movement and timing could go out of sync. maybe something more like running an AnimationCurve? i've used them to drive a Blend Shape previously, but i'm thinking that each desired bone scale could be driven by an AnimationCurve. so you could create curves that would compensate for the increased scale on the top bone by decreasing the scale on the child bones by a similar amount. use the normalized length for the animation (0-1) and sync it to the curve on every frame. problem solved?

    ideally you could have this happen in the Editor and attach it to the Animation window's frame position for the selected animation as well so you could see it change frame by frame. that's probably way beyond my skillset but that would be the most useful option. but even runtime would be an improvement.

    i'm not sure if you're aware of the tools by Fimpossible Games? he has some interesting options - this one appears to be driven by a sinusoid: https://assetstore.unity.com/packages/tools/animation/bones-stimulator-122233

    the script will be useful but i'm most curious about the rigging and what you did it with. i tend to import from Daz into Unity so i'm not quite aware of what null bones are and how or where (or even whether) to add them, but i'm not an experienced rigger either. anyway those are some thoughts.