if (animator)
{ //获得当前动画状态信息(获得的层)
AnimatorStateInfo state = animator.GetCurrentAnimatorStateInfo(0);
//按下鼠标左键的时候切换动画
if (Input.GetButton("Fire1")) animator.SetBool("Jump", true);
//animatyorStateinfo.isname("层名,状态名")判断是否处于这个状态 //层的索引判断是否在这个层
if ( (state.IsName("Base Layer.JumpUp") || state.IsName("Base Layer.FullJump")) && !animator.IsInTransition(0) )
{
animator.SetBool("Jump", false);
//目标点 //目标点旋转 //用什么地方去匹配 //去匹配的权重 (v3(匹配位置的权重),匹配旋转的权重)//什么时候开始匹配 (0当前动作开始的时候,1当前动作结束的时候) 什么时候结束匹配(0-1)
animator.MatchTarget(RightHand.position, RightHand.rotation, AvatarTarget.RightHand, new MatchTargetWeightMask(new Vector3(1, 1, 1), 0), animator.GetFloat("MatchStart"), animator.GetFloat("MatchEnd"));
hasJumped = true;
}
获得动画状态信息
最新推荐文章于 2022-06-06 14:50:53 发布