其他分享
首页 > 其他分享> > Unity3D Spine动画

Unity3D Spine动画

作者:互联网

 

Δ.spine官网: http://zh.esotericsoftware.com/

 

 

Δ.spine哔哩哔哩教程地址:https://www.bilibili.com/video/BV18L411J7ZQ?p=2

 

Δ.spine如何播放动画 如:SkeletonAnimation skeletonAnimation;   skeletonAnimation.state.SetAnimation(0,animaiton,loop);

Δ.如何创建动画引用:Create Animation Reference Assets(一个按钮点击就可以搞定了

      )

Δ.如何让一个2D的物体相反,只需要将它的transform.localScale的x设置为-1,物体就相反了,如 transform.localScale=new Vector2(-1,1);

Δ.可以通过设置rightbody的.velocity设置物体的移动速度,列如:

  float movement=Input.GetAxis("Horizontal")

  if(movement>0)

  {

    rigibody.velocity=new Vector2(movement*speed,rigibody.velocity.y)

  }

 

Δ.玩家跳跃的操作,添加rigidbody,然后给rigidbody的velocity的y轴添加一个值
如:
  if(Input.GetButtonDown("Jump"))
  {
    rigibody.velocity=new Vector2(rigibody.velocity.x,jumpSpeed);
  }

Δ.如何给Spine动画添加完成事件,如下:

  publick void SetAnimation(AnimationReferenceAsset animation,bool loop,float timeScale)

  {    

  Spine.TrackEntry  animationEntry = skeletonAnimation.State.SetAnimation(0,animation,loop);

   animationEntry.Complete+=AnimationEntry_Complete

  }

  private void AnimationEntry_Complete(Spine.TrackEntry trackEntry)

  {

    //动画完成事件处理

  }

   

 

   

 

标签:Unity3D,skeletonAnimation,Complete,动画,Spine,velocity,rigibody
来源: https://www.cnblogs.com/MichaelSam/p/16218116.html