问题描述
在我的游戏中,所有玩家和怪物角色都有一个 NavMeshAgent 组件,当一个角色移到另一个角色时,它将推开第二个角色.
In my game, all player and monster characters have a NavMeshAgent component, when one character moves to another, it will push away the second one.
我阅读了NavMeshAgent的统一文档,发现问题受避障类型和避障优先级的影响,我已经尝试过此方法,但仍然无法找到完美的解决方案,我需要角色不要互相推开,而仍要以其他角色为障碍.
I read the unity docs of NavMeshAgent, found the problem is affected by Obstacle Avoidance Type and Avoidance Priority, I have tried this, but still cannot have a perfect solution, I need the characters DO NOT push each other away and still take others as obstacles.
请给我一些有关如何正确使用NavMeshAgent的建议,并解决此问题.预先感谢.
Please give me some advice how to use NavMeshAgent well and resolve this problem. thanks in advance.
推荐答案
尝试一下这篇文章对我有帮助,也应该对您有所帮助:使用Unity进行RPG/RTS游戏的寻路和本地回避
Give this article a try, it helped me, should help you too: Pathfinding and Local Avoidance for RPG/RTS Games using Unity
这篇关于如何避免两个NavMeshAgent在Unity中相互推开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!