Unity3d Basic API for animation animation player

Source: Internet
Author: User

Directly on the code:

//Animation name  Private Const stringAnim_name ="Take 001"; //Model Objects  PrivateGameobject obj =NULL; //Animation Length  Private floatAnimlegth=0f; //Animation Components  PrivateAnimation m_animation=NULL; Chestnut code://Get model Animations//obj = Gameobject.find ("man"); //get the playback length of the animation; you should get the animation component after the old version can get obj.animation.animation[anim_name].length,5.x directlyM_animation = obj. Getcomponent<animation>(); Animlegth=m_animation[anim_name].length; //Play Animation: 1M_animation.play ();//Play the default animationM_animation.play ("xx");//Play xx animation, the default is to stop the same layer of other animations; function with M_animation.play ("xx", Playmode.stopsamlayer);M_animation.play ("xx", Playmode.stopall);//Play xx animation, all currently playing animations stop//2: Fade the animation with the name animation within a certain amount of timeM_animation.crossfade (string: Animation); M_animation.crossfade (string: Animation,float: Time); M_animation.crossfade (string: Animation,float: Time,playmode:playmode); //determine if the animation is finished; Normalizedtime: Range 0~1, 0 is the beginning of the action, 1 is the end of the action, but for animation like useless, animator is possible, suggest can try, Determine if the value of Normalizedtime is in 0.8~0.9 attempt, or other timing/delegate      if(M_animation.isplaying ("xx") && m_animation["xx"].normalizedtime >=1)        //Rewind Animationm_animation["xx"].speed = -1f*set the animation playback speed; //stop playing an animationM_animation.stop (); M_animation.stop ("xx"); 

Unity3d Basic API for animation animation player

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.