Search Unity

Feedback Please update on some Documentation

Discussion in 'Documentation' started by NizarSama, May 19, 2020.

  1. NizarSama

    NizarSama

    Joined:
    Apr 20, 2015
    Posts:
    10
    I recently have trouble with "Controlling my animation" which i want to do is using float to control the animation time, and i found nothing except legacy stuffs.
    But i noticed on the animation state there is "Motion Time" row that have parameters beside it so i decide to look the Documentation Manual and there is none such "Motion Time" and the picture of animation state it show is pretty old despite the Documentation Ver is 2019.3.
    Then i tried to use it and it solve my problem.
    My point is that an old Documentation like this can pretty much make Developers that using it lost and suffer just to found about simple stuff that not getting mentioned anywhere.

    So please update the Documentation fairly please...

    In case someone looking for like me here simple explanation about "Motion Time"
    Motion Time takes parameter from animator and use it as "normalizedTime" of animation state which give you result that the parameter will control your animation. (min number is 0 max is 1 for the parameter time)
    to use it you just need to click on your animation state and check the parameter box on "Motion Time" row.

    #edit the min max number is not 0-1, there no min max, the number just represent your animation timeline that you can scroll which ever you want
     
  2. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,086
    For those who come across this looking for information on how "Motion Time" works, two things:
    1. This Issue explains where the "Motion Time" came from.
    2. The "Motion Time" field can be used to control the position (time) of the state's AnimationClip (in the "Motion" field). This does not control the overall playback time for the state. You can set the "Motion Time" to a single value and never touch it again. In that case, the animation will be "frozen" for a length of time equal to the length of the AnimationClip. You can control the duration of playback by adjusting the "Multiplier" parameter under the "Speed" field.
    To be clear, Motion Time is a way to force the animation playhead to a position. It does not affect overall playback duration. That appears to be controlled by the AnimationClip specified in the Motion field. You can adjust the duration, but you need to do so by setting the "Speed Multiplier".
     
    alpha_nexus, Xczzxcv, kemijo and 4 others like this.
  3. suiboli

    suiboli

    Joined:
    Mar 27, 2020
    Posts:
    11
    The documents still contains playable graph visualizer, which is not playable in my 2019.4.10. The developer of this program seems to leave unity team, and the account in forum has been deleted.
    Well, the issue has 31 comments in total. 30 of them posted by three users are spams...
    To be more clear at this point, if
    motion time 
    parameter checkbox is checked in Animator inspector, the gameobject controlled by animation clip will not be played. At least, there is no visual movement in my simple switch.

    Anyway, thank you for the clarification. I struggled on motion time for days before I find your advice.
     
    Last edited: Sep 22, 2020
  4. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,086
    To be perhaps overly pedantic, this doesn't really make sense as written. A GameObject cannot be "played". Please correct me if I'm wrong, but I believe what you are implying is:

    ... the GameObject controlled by the AnimationClip will not be animated by that AnimationClip.

    If that's the case, then I do not actually agree with this statement. The Motion Time will "play" the AnimationClip (controlling the GameObject(s)), but it will freeze the AnimationClip's playhead position at the time you specify. The AnimationClip will appear to be paused, but the GameObject(s) that are animated by that AnimationClip will be affected by it - they will simply appear to be in the exact position specified by that "Motion Time" parameter.

    This is a very important distinction because simply "not be played" implies that the AnimationClip will have zero effect on the GameObject(s) which is not actually the case.
     
    suiboli and paternostrox like this.
  5. paternostrox

    paternostrox

    Joined:
    Oct 31, 2015
    Posts:
    42
    In my project I currently spawn multiple animated objects at once, to get variation (that is, not having them animating at the same time) I tried to set each animator motion time to random values. I ended up with my objects frozen at different points of the animation, for what @SonicBloomEric and @suiboli said I guess that's expected.

    Could I set the motion time at random values and get the animation clip to play?
    If that's not a good approach, a couple of questions:
    1) What would be the recommended approach?
    2) Could you describe a situation where the Motion Time would be appropriately used?

    Documentation for the animator should definitely be updated ASAP. It has been tossed aside for more than a year now.
     
    Last edited: Nov 12, 2020
  6. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,086
    You can specify a random start offset when telling an Animator to play a specific state. See the normalizedTime parameter of the Animator.Play method.

    You could probably use the parameter in conjunction with an animation state machine (or other constantly updated component) to drive an effect like the Into the Spider-Verse Suit from Spider-Man: Miles Morales.
     
    kemijo and paternostrox like this.
  7. paternostrox

    paternostrox

    Joined:
    Oct 31, 2015
    Posts:
    42
    Thanks, that's what I'm currently doing now.

    Didn't understood what effect you are reffering to and how would motion time take a role in it. Could you clarify?
     
  8. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,086
    Have you seen Spider-Man: Into the Spider-Verse? The animation in that movie is extremely stylized. It frequently animates at 12fps. From the film's Wiki article (emphasis mine):
    One way to achieve such an effect within Unity would be to author a smooth animation but then freeze the animation at a specific "motion time" for the desired period (1/12 = 83ms; 1/24 = 42ms). Basically, you could "animate" the Motion Time setting using a AnimatorControllerParameter and manually control the "pose" the animation is in at any given time. In short, you could take a "smooth" animation and then force it to visually appear as though it's running at a lower framerate (thus simulating the comic-book style effect shown in the video I previously posted and the trailer I posted in this post).

    As the "parameter" you specify to control that field is one that you set up in the Animator, you can set it from a MonoBehaviour (your own component) or an Animation StateMachineBehaviour (which would let you control it on a per-state basis).
     
  9. paternostrox

    paternostrox

    Joined:
    Oct 31, 2015
    Posts:
    42
    @SonicBloomEric that's a perfect, very comprehensive explanation. Thank you very much.
     
    SonicBloomEric likes this.
  10. JasonsFreeTime

    JasonsFreeTime

    Joined:
    May 23, 2015
    Posts:
    36
    I struggling with this MotionTime parameter for my AnimationState. The checkbox (found in the Editor) for the bool to enable or disable it doesn't appear to be exposed in the API? So how would I be able to (at runtime) turn it on, and set it to a value (to set the animation to a specific point on the timeline? And vise versa - at runtime turn it off so it doesn't block may animation from playing again from that point?
     
    FaberVi and benthroop like this.