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

How to sample animation?

Discussion in 'Animation' started by xCyborg, Sep 30, 2013.

  1. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    633
    Code (csharp):
    1.  
    2.         car.banimation["Defend"].enabled = true;
    3.         car.banimation["Defend"].time = car.banimation["Defend"].length * (percentage);
    4.         car.banimation.Sample();
    5.         print ("sampling: "+car.banimation["Defend"].time);
    6.         car.banimation["Defend"].enabled = false;
    For some reason nothing happens, I'm using Smoothmoves btw and want to sample a specific clip based on percentage (ratio actually), banimation is the BoneAnimation component and is basically just Animation, what to do to solve this?
     
    Last edited: Sep 30, 2013
  2. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    633
    Actually even standard Animation isn't working:
    Code (csharp):
    1.         car.animation["Defend"].enabled = true;
    2.         car.animation["Defend"].time = car.animation["Defend"].length * (percentage);
    3.         car.animation.Sample();
    4.         car.animation["Defend"].enabled = false;
    The anim doesn't show, is that a predicted reaction or a bug somewhere?
     
  3. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    633
  4. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    633