您的位置:首页 > 移动开发 > Unity3D

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

2016-01-03 10:58 731 查看
回到 Animator深入系列总目录

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

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

使用方式:



1.TargetMatching只能工作在base layer

2.InterruptMatchTarget中的completeMatch设为True的话,会立即结束插值自动跳到目标匹配位置。

3.MatchTargetWeightMask是和原有动画之间的权重,如果为1就是完全控制。

4.isMatchingTarget字段确定当前是否在匹配状态

5.startNormalizedTime和targetNormalizedTime是相对于当前动画的匹配开始,结束时间。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: