回到 Animator深入系列总目录

 

 

一开始会理所当然的觉得,匹配是这样的:

Unity-Animator深入系列---目标匹配Target Matching

 

但结果却是这样的(右边的Cube是匹配目标):

Unity-Animator深入系列---目标匹配Target Matching

 

 

感觉这个接口应该是专门为攀爬之类的动画准备的,属于被动匹配位置,移动整个对象去匹配

所以像游戏中的斜面双脚的IK匹配,就和这个接口没关系了:

 Unity-Animator深入系列---目标匹配Target Matching

 

 

OK,下面附上测试代码:

using UnityEngine;

public class MatchTargetExample : MonoBehaviour
{
    public Animator animator;
    public GameObject testTarget;


    [ContextMenu("Start Match")]
    void StartMatch()
    {
        animator.MatchTarget(testTarget.transform.position, testTarget.transform.rotation, AvatarTarget.LeftHand, new MatchTargetWeightMask(Vector3.one, 1f), 0f);
    }

    [ContextMenu("Interrupt Match Target")]
    void InterruptMatchTarget()
    {
        animator.InterruptMatchTarget();
    }
}
MatchTargetExample

相关文章:

  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案