1.Animator的更新只在Update之后LateUpdate之前进行,并不在Update或FixedUpdate里面进行。也就是说在当前帧play了动画的话,那么本帧动画将会表现出来,参考
Execution Order of Event Functions
2.根据上面这一条,rootMotion的更新也在那个时刻进行
3.如何暂停animator中的动画,可以参考下面的代码
Update(){
if(freeze){
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
animator.Play (stateInfo.nameHash, 0, freezeTime);
}
}
NavMeshAgent的坑实验结果:
1.调用NavMeshagent.destination设置目标点,如果目标点是不可达的点,那么结果是destination存放了离目标点最近的点。并且也会让寻路者移动到最近点。移动到最近的点后,remainingDistance为0。
2.调用NavMeshagent.destination设置目标点时,目标点的Y值将会被设置为离agent最近的NavMesh的Y值。
3.NavMeshagent在enable的时候,Unity内部会寻找NavMeshagent最近的NavMesh。最把它放在NavMesh上。
4.调用NavMeshagent.CalculatePath时,如果传入了不可达点path.status会显示PathInvalid。
5.avoidancePriority越小,优先级越高,它会很不友好地把其它优先级低的物体给挤开
6.NavMeshObstacle不能和NavMeshagent同时使用。否则物体将会试图自己躲开自己。表现就是乱跳
7.总的来说,Unity寻路对动态物体躲避做得不好。如果avoidancePriority无法满足需求的话,请选用astar pathing这种第三方插件。
8.NavMeshAgent启用的时候,CharacterController就不起作用。CharacterController在遇到有碰撞的障碍物时,会尝试微调绕过物体。